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

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

Issue 2019423006: Adding more detail to MessageQueue::Dispatch logging. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
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
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 "", // TCP canddiate type, empty for turn candidates. 735 "", // TCP canddiate type, empty for turn candidates.
736 RELAY_PORT_TYPE, 736 RELAY_PORT_TYPE,
737 GetRelayPreference(server_address_.proto, server_address_.secure), 737 GetRelayPreference(server_address_.proto, server_address_.secure),
738 server_priority_, true); 738 server_priority_, true);
739 } 739 }
740 740
741 void TurnPort::OnAllocateError() { 741 void TurnPort::OnAllocateError() {
742 // We will send SignalPortError asynchronously as this can be sent during 742 // We will send SignalPortError asynchronously as this can be sent during
743 // port initialization. This way it will not be blocking other port 743 // port initialization. This way it will not be blocking other port
744 // creation. 744 // creation.
745 thread()->Post(this, MSG_ALLOCATE_ERROR); 745 thread()->Post(FROM_HERE, this, MSG_ALLOCATE_ERROR);
746 } 746 }
747 747
748 void TurnPort::OnTurnRefreshError() { 748 void TurnPort::OnTurnRefreshError() {
749 // Need to Close the port asynchronously because otherwise, the refresh 749 // Need to Close the port asynchronously because otherwise, the refresh
750 // request may be deleted twice: once at the end of the message processing 750 // request may be deleted twice: once at the end of the message processing
751 // and the other in Close(). 751 // and the other in Close().
752 thread()->Post(this, MSG_REFRESH_ERROR); 752 thread()->Post(FROM_HERE, this, MSG_REFRESH_ERROR);
753 } 753 }
754 754
755 void TurnPort::Close() { 755 void TurnPort::Close() {
756 if (!ready()) { 756 if (!ready()) {
757 OnAllocateError(); 757 OnAllocateError();
758 } 758 }
759 request_manager_.Clear(); 759 request_manager_.Clear();
760 // Stop the port from creating new connections. 760 // Stop the port from creating new connections.
761 state_ = STATE_DISCONNECTED; 761 state_ = STATE_DISCONNECTED;
762 // Delete all existing connections; stop sending data. 762 // Delete all existing connections; stop sending data.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 TurnEntry* entry = FindEntry(remote_address); 1025 TurnEntry* entry = FindEntry(remote_address);
1026 ASSERT(entry != NULL); 1026 ASSERT(entry != NULL);
1027 ScheduleEntryDestruction(entry); 1027 ScheduleEntryDestruction(entry);
1028 } 1028 }
1029 1029
1030 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) { 1030 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) {
1031 ASSERT(entry->destruction_timestamp() == 0); 1031 ASSERT(entry->destruction_timestamp() == 0);
1032 int64_t timestamp = rtc::TimeMillis(); 1032 int64_t timestamp = rtc::TimeMillis();
1033 entry->set_destruction_timestamp(timestamp); 1033 entry->set_destruction_timestamp(timestamp);
1034 invoker_.AsyncInvokeDelayed<void>( 1034 invoker_.AsyncInvokeDelayed<void>(
1035 thread(), 1035 FROM_HERE, thread(),
1036 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp), 1036 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp),
1037 TURN_PERMISSION_TIMEOUT); 1037 TURN_PERMISSION_TIMEOUT);
1038 } 1038 }
1039 1039
1040 void TurnPort::CancelEntryDestruction(TurnEntry* entry) { 1040 void TurnPort::CancelEntryDestruction(TurnEntry* entry) {
1041 ASSERT(entry->destruction_timestamp() != 0); 1041 ASSERT(entry->destruction_timestamp() != 0);
1042 entry->set_destruction_timestamp(0); 1042 entry->set_destruction_timestamp(0);
1043 } 1043 }
1044 1044
1045 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address, 1045 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 switch (error_code->code()) { 1125 switch (error_code->code()) {
1126 case STUN_ERROR_UNAUTHORIZED: // Unauthrorized. 1126 case STUN_ERROR_UNAUTHORIZED: // Unauthrorized.
1127 OnAuthChallenge(response, error_code->code()); 1127 OnAuthChallenge(response, error_code->code());
1128 break; 1128 break;
1129 case STUN_ERROR_TRY_ALTERNATE: 1129 case STUN_ERROR_TRY_ALTERNATE:
1130 OnTryAlternate(response, error_code->code()); 1130 OnTryAlternate(response, error_code->code());
1131 break; 1131 break;
1132 case STUN_ERROR_ALLOCATION_MISMATCH: 1132 case STUN_ERROR_ALLOCATION_MISMATCH:
1133 // We must handle this error async because trying to delete the socket in 1133 // We must handle this error async because trying to delete the socket in
1134 // OnErrorResponse will cause a deadlock on the socket. 1134 // OnErrorResponse will cause a deadlock on the socket.
1135 port_->thread()->Post(port_, TurnPort::MSG_ALLOCATE_MISMATCH); 1135 port_->thread()->Post(FROM_HERE, port_, TurnPort::MSG_ALLOCATE_MISMATCH);
1136 break; 1136 break;
1137 default: 1137 default:
1138 LOG_J(LS_WARNING, port_) << "Received TURN allocate error response" 1138 LOG_J(LS_WARNING, port_) << "Received TURN allocate error response"
1139 << ", id=" << rtc::hex_encode(id()) 1139 << ", id=" << rtc::hex_encode(id())
1140 << ", code=" << error_code->code() 1140 << ", code=" << error_code->code()
1141 << ", rtt=" << Elapsed(); 1141 << ", rtt=" << Elapsed();
1142 port_->OnAllocateError(); 1142 port_->OnAllocateError();
1143 } 1143 }
1144 } 1144 }
1145 1145
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 response->GetByteString(STUN_ATTR_NONCE); 1214 response->GetByteString(STUN_ATTR_NONCE);
1215 if (nonce_attr) { 1215 if (nonce_attr) {
1216 LOG_J(LS_INFO, port_) << "Applying STUN_ATTR_NONCE attribute in " 1216 LOG_J(LS_INFO, port_) << "Applying STUN_ATTR_NONCE attribute in "
1217 << "try alternate error response."; 1217 << "try alternate error response.";
1218 port_->set_nonce(nonce_attr->GetString()); 1218 port_->set_nonce(nonce_attr->GetString());
1219 } 1219 }
1220 1220
1221 // For TCP, we can't close the original Tcp socket during handling a 300 as 1221 // For TCP, we can't close the original Tcp socket during handling a 300 as
1222 // we're still inside that socket's event handler. Doing so will cause 1222 // we're still inside that socket's event handler. Doing so will cause
1223 // deadlock. 1223 // deadlock.
1224 port_->thread()->Post(port_, TurnPort::MSG_TRY_ALTERNATE_SERVER); 1224 port_->thread()->Post(FROM_HERE, port_, TurnPort::MSG_TRY_ALTERNATE_SERVER);
1225 } 1225 }
1226 1226
1227 TurnRefreshRequest::TurnRefreshRequest(TurnPort* port) 1227 TurnRefreshRequest::TurnRefreshRequest(TurnPort* port)
1228 : StunRequest(new TurnMessage()), 1228 : StunRequest(new TurnMessage()),
1229 port_(port), 1229 port_(port),
1230 lifetime_(-1) { 1230 lifetime_(-1) {
1231 } 1231 }
1232 1232
1233 void TurnRefreshRequest::Prepare(StunMessage* request) { 1233 void TurnRefreshRequest::Prepare(StunMessage* request) {
1234 // Create the request as indicated in RFC 5766, Section 7.1. 1234 // Create the request as indicated in RFC 5766, Section 7.1.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } else { 1530 } else {
1531 state_ = STATE_UNBOUND; 1531 state_ = STATE_UNBOUND;
1532 port_->DestroyConnection(ext_addr_); 1532 port_->DestroyConnection(ext_addr_);
1533 } 1533 }
1534 } 1534 }
1535 void TurnEntry::OnChannelBindTimeout() { 1535 void TurnEntry::OnChannelBindTimeout() {
1536 state_ = STATE_UNBOUND; 1536 state_ = STATE_UNBOUND;
1537 port_->DestroyConnection(ext_addr_); 1537 port_->DestroyConnection(ext_addr_);
1538 } 1538 }
1539 } // namespace cricket 1539 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698