Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: webrtc/p2p/base/turnport.cc

Issue 2620303003: Replace ASSERT by RTC_DCHECK in all non-test code. (Closed)
Patch Set: Address final nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/tcpport.cc ('k') | webrtc/p2p/base/turnserver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/p2p/base/turnport.h" 11 #include "webrtc/p2p/base/turnport.h"
12 12
13 #include <functional> 13 #include <functional>
14 14
15 #include "webrtc/p2p/base/common.h" 15 #include "webrtc/p2p/base/common.h"
16 #include "webrtc/p2p/base/stun.h" 16 #include "webrtc/p2p/base/stun.h"
17 #include "webrtc/base/asyncpacketsocket.h" 17 #include "webrtc/base/asyncpacketsocket.h"
18 #include "webrtc/base/byteorder.h" 18 #include "webrtc/base/byteorder.h"
19 #include "webrtc/base/checks.h"
19 #include "webrtc/base/common.h" 20 #include "webrtc/base/common.h"
20 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
21 #include "webrtc/base/nethelpers.h" 22 #include "webrtc/base/nethelpers.h"
22 #include "webrtc/base/socketaddress.h" 23 #include "webrtc/base/socketaddress.h"
23 #include "webrtc/base/stringencode.h" 24 #include "webrtc/base/stringencode.h"
24 25
25 namespace cricket { 26 namespace cricket {
26 27
27 // TODO(juberti): Move to stun.h when relay messages have been renamed. 28 // TODO(juberti): Move to stun.h when relay messages have been renamed.
28 static const int TURN_ALLOCATE_REQUEST = STUN_ALLOCATE_REQUEST; 29 static const int TURN_ALLOCATE_REQUEST = STUN_ALLOCATE_REQUEST;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 311 }
311 if (server_address_.proto == PROTO_UDP) { 312 if (server_address_.proto == PROTO_UDP) {
312 // If its UDP, send AllocateRequest now. 313 // If its UDP, send AllocateRequest now.
313 // For TCP and TLS AllcateRequest will be sent by OnSocketConnect. 314 // For TCP and TLS AllcateRequest will be sent by OnSocketConnect.
314 SendRequest(new TurnAllocateRequest(this), 0); 315 SendRequest(new TurnAllocateRequest(this), 0);
315 } 316 }
316 } 317 }
317 } 318 }
318 319
319 bool TurnPort::CreateTurnClientSocket() { 320 bool TurnPort::CreateTurnClientSocket() {
320 ASSERT(!socket_ || SharedSocket()); 321 RTC_DCHECK(!socket_ || SharedSocket());
321 322
322 if (server_address_.proto == PROTO_UDP && !SharedSocket()) { 323 if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
323 socket_ = socket_factory()->CreateUdpSocket( 324 socket_ = socket_factory()->CreateUdpSocket(
324 rtc::SocketAddress(ip(), 0), min_port(), max_port()); 325 rtc::SocketAddress(ip(), 0), min_port(), max_port());
325 } else if (server_address_.proto == PROTO_TCP || 326 } else if (server_address_.proto == PROTO_TCP ||
326 server_address_.proto == PROTO_TLS) { 327 server_address_.proto == PROTO_TLS) {
327 ASSERT(!SharedSocket()); 328 RTC_DCHECK(!SharedSocket());
328 int opts = rtc::PacketSocketFactory::OPT_STUN; 329 int opts = rtc::PacketSocketFactory::OPT_STUN;
329 330
330 // Apply server address TLS and insecure bits to options. 331 // Apply server address TLS and insecure bits to options.
331 if (server_address_.proto == PROTO_TLS) { 332 if (server_address_.proto == PROTO_TLS) {
332 if (tls_cert_policy_ == 333 if (tls_cert_policy_ ==
333 TlsCertPolicy::TLS_CERT_POLICY_INSECURE_NO_CHECK) { 334 TlsCertPolicy::TLS_CERT_POLICY_INSECURE_NO_CHECK) {
334 opts |= rtc::PacketSocketFactory::OPT_TLS_INSECURE; 335 opts |= rtc::PacketSocketFactory::OPT_TLS_INSECURE;
335 } else { 336 } else {
336 opts |= rtc::PacketSocketFactory::OPT_TLS; 337 opts |= rtc::PacketSocketFactory::OPT_TLS;
337 } 338 }
(...skipping 30 matching lines...) Expand all
368 server_address_.proto == PROTO_TLS) { 369 server_address_.proto == PROTO_TLS) {
369 socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect); 370 socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect);
370 socket_->SignalClose.connect(this, &TurnPort::OnSocketClose); 371 socket_->SignalClose.connect(this, &TurnPort::OnSocketClose);
371 } else { 372 } else {
372 state_ = STATE_CONNECTED; 373 state_ = STATE_CONNECTED;
373 } 374 }
374 return true; 375 return true;
375 } 376 }
376 377
377 void TurnPort::OnSocketConnect(rtc::AsyncPacketSocket* socket) { 378 void TurnPort::OnSocketConnect(rtc::AsyncPacketSocket* socket) {
378 ASSERT(server_address_.proto == PROTO_TCP); 379 RTC_DCHECK(server_address_.proto == PROTO_TCP);
379 // Do not use this port if the socket bound to a different address than 380 // Do not use this port if the socket bound to a different address than
380 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be 381 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be
381 // given a binding address, and the platform is expected to pick the 382 // given a binding address, and the platform is expected to pick the
382 // correct local address. 383 // correct local address.
383 384
384 // However, there are two situations in which we allow the bound address to 385 // However, there are two situations in which we allow the bound address to
385 // differ from the requested address: 1. The bound address is the loopback 386 // differ from the requested address: 1. The bound address is the loopback
386 // address. This happens when a proxy forces TCP to bind to only the 387 // address. This happens when a proxy forces TCP to bind to only the
387 // localhost address (see issue 3927). 2. The bound address is the "any 388 // localhost address (see issue 3927). 2. The bound address is the "any
388 // address". This happens when multiple_routes is disabled (see issue 4780). 389 // address". This happens when multiple_routes is disabled (see issue 4780).
(...skipping 24 matching lines...) Expand all
413 server_address_.address = socket_->GetRemoteAddress(); 414 server_address_.address = socket_->GetRemoteAddress();
414 } 415 }
415 416
416 LOG(LS_INFO) << "TurnPort connected to " << socket->GetRemoteAddress() 417 LOG(LS_INFO) << "TurnPort connected to " << socket->GetRemoteAddress()
417 << " using tcp."; 418 << " using tcp.";
418 SendRequest(new TurnAllocateRequest(this), 0); 419 SendRequest(new TurnAllocateRequest(this), 0);
419 } 420 }
420 421
421 void TurnPort::OnSocketClose(rtc::AsyncPacketSocket* socket, int error) { 422 void TurnPort::OnSocketClose(rtc::AsyncPacketSocket* socket, int error) {
422 LOG_J(LS_WARNING, this) << "Connection with server failed, error=" << error; 423 LOG_J(LS_WARNING, this) << "Connection with server failed, error=" << error;
423 ASSERT(socket == socket_); 424 RTC_DCHECK(socket == socket_);
424 Close(); 425 Close();
425 } 426 }
426 427
427 void TurnPort::OnAllocateMismatch() { 428 void TurnPort::OnAllocateMismatch() {
428 if (allocate_mismatch_retries_ >= MAX_ALLOCATE_MISMATCH_RETRIES) { 429 if (allocate_mismatch_retries_ >= MAX_ALLOCATE_MISMATCH_RETRIES) {
429 LOG_J(LS_WARNING, this) << "Giving up on the port after " 430 LOG_J(LS_WARNING, this) << "Giving up on the port after "
430 << allocate_mismatch_retries_ 431 << allocate_mismatch_retries_
431 << " retries for STUN_ERROR_ALLOCATION_MISMATCH"; 432 << " retries for STUN_ERROR_ALLOCATION_MISMATCH";
432 OnAllocateError(); 433 OnAllocateError();
433 return; 434 return;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return; 674 return;
674 675
675 LOG_J(LS_INFO, this) << "Starting TURN host lookup for " 676 LOG_J(LS_INFO, this) << "Starting TURN host lookup for "
676 << address.ToSensitiveString(); 677 << address.ToSensitiveString();
677 resolver_ = socket_factory()->CreateAsyncResolver(); 678 resolver_ = socket_factory()->CreateAsyncResolver();
678 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult); 679 resolver_->SignalDone.connect(this, &TurnPort::OnResolveResult);
679 resolver_->Start(address); 680 resolver_->Start(address);
680 } 681 }
681 682
682 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) { 683 void TurnPort::OnResolveResult(rtc::AsyncResolverInterface* resolver) {
683 ASSERT(resolver == resolver_); 684 RTC_DCHECK(resolver == resolver_);
684 // If DNS resolve is failed when trying to connect to the server using TCP, 685 // If DNS resolve is failed when trying to connect to the server using TCP,
685 // one of the reason could be due to DNS queries blocked by firewall. 686 // one of the reason could be due to DNS queries blocked by firewall.
686 // In such cases we will try to connect to the server with hostname, assuming 687 // In such cases we will try to connect to the server with hostname, assuming
687 // socket layer will resolve the hostname through a HTTP proxy (if any). 688 // socket layer will resolve the hostname through a HTTP proxy (if any).
688 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) { 689 if (resolver_->GetError() != 0 && server_address_.proto == PROTO_TCP) {
689 if (!CreateTurnClientSocket()) { 690 if (!CreateTurnClientSocket()) {
690 OnAllocateError(); 691 OnAllocateError();
691 } 692 }
692 return; 693 return;
693 } 694 }
(...skipping 12 matching lines...) Expand all
706 // Signal needs both resolved and unresolved address. After signal is sent 707 // Signal needs both resolved and unresolved address. After signal is sent
707 // we can copy resolved address back into |server_address_|. 708 // we can copy resolved address back into |server_address_|.
708 SignalResolvedServerAddress(this, server_address_.address, 709 SignalResolvedServerAddress(this, server_address_.address,
709 resolved_address); 710 resolved_address);
710 server_address_.address = resolved_address; 711 server_address_.address = resolved_address;
711 PrepareAddress(); 712 PrepareAddress();
712 } 713 }
713 714
714 void TurnPort::OnSendStunPacket(const void* data, size_t size, 715 void TurnPort::OnSendStunPacket(const void* data, size_t size,
715 StunRequest* request) { 716 StunRequest* request) {
716 ASSERT(connected()); 717 RTC_DCHECK(connected());
717 rtc::PacketOptions options(DefaultDscpValue()); 718 rtc::PacketOptions options(DefaultDscpValue());
718 if (Send(data, size, options) < 0) { 719 if (Send(data, size, options) < 0) {
719 LOG_J(LS_ERROR, this) << "Failed to send TURN message, err=" 720 LOG_J(LS_ERROR, this) << "Failed to send TURN message, err="
720 << socket_->GetError(); 721 << socket_->GetError();
721 } 722 }
722 } 723 }
723 724
724 void TurnPort::OnStunAddress(const rtc::SocketAddress& address) { 725 void TurnPort::OnStunAddress(const rtc::SocketAddress& address) {
725 // STUN Port will discover STUN candidate, as it's supplied with first TURN 726 // STUN Port will discover STUN candidate, as it's supplied with first TURN
726 // server address. 727 // server address.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 break; 798 break;
798 case MSG_TRY_ALTERNATE_SERVER: 799 case MSG_TRY_ALTERNATE_SERVER:
799 if (server_address().proto == PROTO_UDP) { 800 if (server_address().proto == PROTO_UDP) {
800 // Send another allocate request to alternate server, with the received 801 // Send another allocate request to alternate server, with the received
801 // realm and nonce values. 802 // realm and nonce values.
802 SendRequest(new TurnAllocateRequest(this), 0); 803 SendRequest(new TurnAllocateRequest(this), 0);
803 } else { 804 } else {
804 // Since it's TCP, we have to delete the connected socket and reconnect 805 // Since it's TCP, we have to delete the connected socket and reconnect
805 // with the alternate server. PrepareAddress will send stun binding once 806 // with the alternate server. PrepareAddress will send stun binding once
806 // the new socket is connected. 807 // the new socket is connected.
807 ASSERT(server_address().proto == PROTO_TCP); 808 RTC_DCHECK(server_address().proto == PROTO_TCP);
808 ASSERT(!SharedSocket()); 809 RTC_DCHECK(!SharedSocket());
809 delete socket_; 810 delete socket_;
810 socket_ = NULL; 811 socket_ = NULL;
811 PrepareAddress(); 812 PrepareAddress();
812 } 813 }
813 break; 814 break;
814 default: 815 default:
815 Port::OnMessage(message); 816 Port::OnMessage(message);
816 } 817 }
817 } 818 }
818 819
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 entry = new TurnEntry(this, next_channel_number_++, addr); 1015 entry = new TurnEntry(this, next_channel_number_++, addr);
1015 entries_.push_back(entry); 1016 entries_.push_back(entry);
1016 } else { 1017 } else {
1017 // The channel binding request for the entry will be refreshed automatically 1018 // The channel binding request for the entry will be refreshed automatically
1018 // until the entry is destroyed. 1019 // until the entry is destroyed.
1019 CancelEntryDestruction(entry); 1020 CancelEntryDestruction(entry);
1020 } 1021 }
1021 } 1022 }
1022 1023
1023 void TurnPort::DestroyEntry(TurnEntry* entry) { 1024 void TurnPort::DestroyEntry(TurnEntry* entry) {
1024 ASSERT(entry != NULL); 1025 RTC_DCHECK(entry != NULL);
1025 entry->SignalDestroyed(entry); 1026 entry->SignalDestroyed(entry);
1026 entries_.remove(entry); 1027 entries_.remove(entry);
1027 delete entry; 1028 delete entry;
1028 } 1029 }
1029 1030
1030 void TurnPort::DestroyEntryIfNotCancelled(TurnEntry* entry, int64_t timestamp) { 1031 void TurnPort::DestroyEntryIfNotCancelled(TurnEntry* entry, int64_t timestamp) {
1031 if (!EntryExists(entry)) { 1032 if (!EntryExists(entry)) {
1032 return; 1033 return;
1033 } 1034 }
1034 bool cancelled = timestamp != entry->destruction_timestamp(); 1035 bool cancelled = timestamp != entry->destruction_timestamp();
1035 if (!cancelled) { 1036 if (!cancelled) {
1036 DestroyEntry(entry); 1037 DestroyEntry(entry);
1037 } 1038 }
1038 } 1039 }
1039 1040
1040 void TurnPort::HandleConnectionDestroyed(Connection* conn) { 1041 void TurnPort::HandleConnectionDestroyed(Connection* conn) {
1041 // Schedule an event to destroy TurnEntry for the connection, which is 1042 // Schedule an event to destroy TurnEntry for the connection, which is
1042 // already destroyed. 1043 // already destroyed.
1043 const rtc::SocketAddress& remote_address = conn->remote_candidate().address(); 1044 const rtc::SocketAddress& remote_address = conn->remote_candidate().address();
1044 TurnEntry* entry = FindEntry(remote_address); 1045 TurnEntry* entry = FindEntry(remote_address);
1045 ASSERT(entry != NULL); 1046 RTC_DCHECK(entry != NULL);
1046 ScheduleEntryDestruction(entry); 1047 ScheduleEntryDestruction(entry);
1047 } 1048 }
1048 1049
1049 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) { 1050 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) {
1050 ASSERT(entry->destruction_timestamp() == 0); 1051 RTC_DCHECK(entry->destruction_timestamp() == 0);
1051 int64_t timestamp = rtc::TimeMillis(); 1052 int64_t timestamp = rtc::TimeMillis();
1052 entry->set_destruction_timestamp(timestamp); 1053 entry->set_destruction_timestamp(timestamp);
1053 invoker_.AsyncInvokeDelayed<void>( 1054 invoker_.AsyncInvokeDelayed<void>(
1054 RTC_FROM_HERE, thread(), 1055 RTC_FROM_HERE, thread(),
1055 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp), 1056 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp),
1056 TURN_PERMISSION_TIMEOUT); 1057 TURN_PERMISSION_TIMEOUT);
1057 } 1058 }
1058 1059
1059 void TurnPort::CancelEntryDestruction(TurnEntry* entry) { 1060 void TurnPort::CancelEntryDestruction(TurnEntry* entry) {
1060 ASSERT(entry->destruction_timestamp() != 0); 1061 RTC_DCHECK(entry->destruction_timestamp() != 0);
1061 entry->set_destruction_timestamp(0); 1062 entry->set_destruction_timestamp(0);
1062 } 1063 }
1063 1064
1064 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address, 1065 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address,
1065 int channel_id) { 1066 int channel_id) {
1066 TurnEntry* entry = FindEntry(address); 1067 TurnEntry* entry = FindEntry(address);
1067 if (!entry) { 1068 if (!entry) {
1068 return false; 1069 return false;
1069 } 1070 }
1070 entry->set_channel_id(channel_id); 1071 entry->set_channel_id(channel_id);
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1362
1362 void TurnCreatePermissionRequest::OnTimeout() { 1363 void TurnCreatePermissionRequest::OnTimeout() {
1363 LOG_J(LS_WARNING, port_) << "TURN create permission timeout " 1364 LOG_J(LS_WARNING, port_) << "TURN create permission timeout "
1364 << rtc::hex_encode(id()); 1365 << rtc::hex_encode(id());
1365 if (entry_) { 1366 if (entry_) {
1366 entry_->OnCreatePermissionTimeout(); 1367 entry_->OnCreatePermissionTimeout();
1367 } 1368 }
1368 } 1369 }
1369 1370
1370 void TurnCreatePermissionRequest::OnEntryDestroyed(TurnEntry* entry) { 1371 void TurnCreatePermissionRequest::OnEntryDestroyed(TurnEntry* entry) {
1371 ASSERT(entry_ == entry); 1372 RTC_DCHECK(entry_ == entry);
1372 entry_ = NULL; 1373 entry_ = NULL;
1373 } 1374 }
1374 1375
1375 TurnChannelBindRequest::TurnChannelBindRequest( 1376 TurnChannelBindRequest::TurnChannelBindRequest(
1376 TurnPort* port, TurnEntry* entry, 1377 TurnPort* port, TurnEntry* entry,
1377 int channel_id, const rtc::SocketAddress& ext_addr) 1378 int channel_id, const rtc::SocketAddress& ext_addr)
1378 : StunRequest(new TurnMessage()), 1379 : StunRequest(new TurnMessage()),
1379 port_(port), 1380 port_(port),
1380 entry_(entry), 1381 entry_(entry),
1381 channel_id_(channel_id), 1382 channel_id_(channel_id),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 1432
1432 void TurnChannelBindRequest::OnTimeout() { 1433 void TurnChannelBindRequest::OnTimeout() {
1433 LOG_J(LS_WARNING, port_) << "TURN channel bind timeout " 1434 LOG_J(LS_WARNING, port_) << "TURN channel bind timeout "
1434 << rtc::hex_encode(id()); 1435 << rtc::hex_encode(id());
1435 if (entry_) { 1436 if (entry_) {
1436 entry_->OnChannelBindTimeout(); 1437 entry_->OnChannelBindTimeout();
1437 } 1438 }
1438 } 1439 }
1439 1440
1440 void TurnChannelBindRequest::OnEntryDestroyed(TurnEntry* entry) { 1441 void TurnChannelBindRequest::OnEntryDestroyed(TurnEntry* entry) {
1441 ASSERT(entry_ == entry); 1442 RTC_DCHECK(entry_ == entry);
1442 entry_ = NULL; 1443 entry_ = NULL;
1443 } 1444 }
1444 1445
1445 TurnEntry::TurnEntry(TurnPort* port, int channel_id, 1446 TurnEntry::TurnEntry(TurnPort* port, int channel_id,
1446 const rtc::SocketAddress& ext_addr) 1447 const rtc::SocketAddress& ext_addr)
1447 : port_(port), 1448 : port_(port),
1448 channel_id_(channel_id), 1449 channel_id_(channel_id),
1449 ext_addr_(ext_addr), 1450 ext_addr_(ext_addr),
1450 state_(STATE_UNBOUND) { 1451 state_(STATE_UNBOUND) {
1451 // Creating permission for |ext_addr_|. 1452 // Creating permission for |ext_addr_|.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 } 1527 }
1527 } 1528 }
1528 1529
1529 void TurnEntry::OnCreatePermissionTimeout() { 1530 void TurnEntry::OnCreatePermissionTimeout() {
1530 port_->FailAndPruneConnection(ext_addr_); 1531 port_->FailAndPruneConnection(ext_addr_);
1531 } 1532 }
1532 1533
1533 void TurnEntry::OnChannelBindSuccess() { 1534 void TurnEntry::OnChannelBindSuccess() {
1534 LOG_J(LS_INFO, port_) << "Channel bind for " << ext_addr_.ToSensitiveString() 1535 LOG_J(LS_INFO, port_) << "Channel bind for " << ext_addr_.ToSensitiveString()
1535 << " succeeded"; 1536 << " succeeded";
1536 ASSERT(state_ == STATE_BINDING || state_ == STATE_BOUND); 1537 RTC_DCHECK(state_ == STATE_BINDING || state_ == STATE_BOUND);
1537 state_ = STATE_BOUND; 1538 state_ = STATE_BOUND;
1538 } 1539 }
1539 1540
1540 void TurnEntry::OnChannelBindError(StunMessage* response, int code) { 1541 void TurnEntry::OnChannelBindError(StunMessage* response, int code) {
1541 // If the channel bind fails due to errors other than STATE_NONCE, 1542 // If the channel bind fails due to errors other than STATE_NONCE,
1542 // we will fail and prune the connection and rely on ICE restart to 1543 // we will fail and prune the connection and rely on ICE restart to
1543 // re-establish a new connection if needed. 1544 // re-establish a new connection if needed.
1544 if (code == STUN_ERROR_STALE_NONCE) { 1545 if (code == STUN_ERROR_STALE_NONCE) {
1545 if (port_->UpdateNonce(response)) { 1546 if (port_->UpdateNonce(response)) {
1546 // Send channel bind request with fresh nonce. 1547 // Send channel bind request with fresh nonce.
1547 SendChannelBindRequest(0); 1548 SendChannelBindRequest(0);
1548 } 1549 }
1549 } else { 1550 } else {
1550 state_ = STATE_UNBOUND; 1551 state_ = STATE_UNBOUND;
1551 port_->FailAndPruneConnection(ext_addr_); 1552 port_->FailAndPruneConnection(ext_addr_);
1552 } 1553 }
1553 } 1554 }
1554 void TurnEntry::OnChannelBindTimeout() { 1555 void TurnEntry::OnChannelBindTimeout() {
1555 state_ = STATE_UNBOUND; 1556 state_ = STATE_UNBOUND;
1556 port_->FailAndPruneConnection(ext_addr_); 1557 port_->FailAndPruneConnection(ext_addr_);
1557 } 1558 }
1558 } // namespace cricket 1559 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/tcpport.cc ('k') | webrtc/p2p/base/turnserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698