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

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: Fixing one more place where RTC_FROM_HERE wasn't used. 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
« no previous file with comments | « webrtc/p2p/base/transportcontroller_unittest.cc ('k') | webrtc/p2p/base/turnport_unittest.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
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 "", // TCP canddiate type, empty for turn candidates. 729 "", // TCP canddiate type, empty for turn candidates.
730 RELAY_PORT_TYPE, 730 RELAY_PORT_TYPE,
731 GetRelayPreference(server_address_.proto, server_address_.secure), 731 GetRelayPreference(server_address_.proto, server_address_.secure),
732 server_priority_, true); 732 server_priority_, true);
733 } 733 }
734 734
735 void TurnPort::OnAllocateError() { 735 void TurnPort::OnAllocateError() {
736 // We will send SignalPortError asynchronously as this can be sent during 736 // We will send SignalPortError asynchronously as this can be sent during
737 // port initialization. This way it will not be blocking other port 737 // port initialization. This way it will not be blocking other port
738 // creation. 738 // creation.
739 thread()->Post(this, MSG_ALLOCATE_ERROR); 739 thread()->Post(RTC_FROM_HERE, this, MSG_ALLOCATE_ERROR);
740 } 740 }
741 741
742 void TurnPort::OnTurnRefreshError() { 742 void TurnPort::OnTurnRefreshError() {
743 // Need to Close the port asynchronously because otherwise, the refresh 743 // Need to Close the port asynchronously because otherwise, the refresh
744 // request may be deleted twice: once at the end of the message processing 744 // request may be deleted twice: once at the end of the message processing
745 // and the other in Close(). 745 // and the other in Close().
746 thread()->Post(this, MSG_REFRESH_ERROR); 746 thread()->Post(RTC_FROM_HERE, this, MSG_REFRESH_ERROR);
747 } 747 }
748 748
749 void TurnPort::Close() { 749 void TurnPort::Close() {
750 if (!ready()) { 750 if (!ready()) {
751 OnAllocateError(); 751 OnAllocateError();
752 } 752 }
753 request_manager_.Clear(); 753 request_manager_.Clear();
754 // Stop the port from creating new connections. 754 // Stop the port from creating new connections.
755 state_ = STATE_DISCONNECTED; 755 state_ = STATE_DISCONNECTED;
756 // Delete all existing connections; stop sending data. 756 // Delete all existing connections; stop sending data.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 TurnEntry* entry = FindEntry(remote_address); 1019 TurnEntry* entry = FindEntry(remote_address);
1020 ASSERT(entry != NULL); 1020 ASSERT(entry != NULL);
1021 ScheduleEntryDestruction(entry); 1021 ScheduleEntryDestruction(entry);
1022 } 1022 }
1023 1023
1024 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) { 1024 void TurnPort::ScheduleEntryDestruction(TurnEntry* entry) {
1025 ASSERT(entry->destruction_timestamp() == 0); 1025 ASSERT(entry->destruction_timestamp() == 0);
1026 int64_t timestamp = rtc::TimeMillis(); 1026 int64_t timestamp = rtc::TimeMillis();
1027 entry->set_destruction_timestamp(timestamp); 1027 entry->set_destruction_timestamp(timestamp);
1028 invoker_.AsyncInvokeDelayed<void>( 1028 invoker_.AsyncInvokeDelayed<void>(
1029 thread(), 1029 RTC_FROM_HERE, thread(),
1030 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp), 1030 rtc::Bind(&TurnPort::DestroyEntryIfNotCancelled, this, entry, timestamp),
1031 TURN_PERMISSION_TIMEOUT); 1031 TURN_PERMISSION_TIMEOUT);
1032 } 1032 }
1033 1033
1034 void TurnPort::CancelEntryDestruction(TurnEntry* entry) { 1034 void TurnPort::CancelEntryDestruction(TurnEntry* entry) {
1035 ASSERT(entry->destruction_timestamp() != 0); 1035 ASSERT(entry->destruction_timestamp() != 0);
1036 entry->set_destruction_timestamp(0); 1036 entry->set_destruction_timestamp(0);
1037 } 1037 }
1038 1038
1039 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address, 1039 bool TurnPort::SetEntryChannelId(const rtc::SocketAddress& address,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 switch (error_code->code()) { 1119 switch (error_code->code()) {
1120 case STUN_ERROR_UNAUTHORIZED: // Unauthrorized. 1120 case STUN_ERROR_UNAUTHORIZED: // Unauthrorized.
1121 OnAuthChallenge(response, error_code->code()); 1121 OnAuthChallenge(response, error_code->code());
1122 break; 1122 break;
1123 case STUN_ERROR_TRY_ALTERNATE: 1123 case STUN_ERROR_TRY_ALTERNATE:
1124 OnTryAlternate(response, error_code->code()); 1124 OnTryAlternate(response, error_code->code());
1125 break; 1125 break;
1126 case STUN_ERROR_ALLOCATION_MISMATCH: 1126 case STUN_ERROR_ALLOCATION_MISMATCH:
1127 // We must handle this error async because trying to delete the socket in 1127 // We must handle this error async because trying to delete the socket in
1128 // OnErrorResponse will cause a deadlock on the socket. 1128 // OnErrorResponse will cause a deadlock on the socket.
1129 port_->thread()->Post(port_, TurnPort::MSG_ALLOCATE_MISMATCH); 1129 port_->thread()->Post(RTC_FROM_HERE, port_,
1130 TurnPort::MSG_ALLOCATE_MISMATCH);
1130 break; 1131 break;
1131 default: 1132 default:
1132 LOG_J(LS_WARNING, port_) << "Received TURN allocate error response" 1133 LOG_J(LS_WARNING, port_) << "Received TURN allocate error response"
1133 << ", id=" << rtc::hex_encode(id()) 1134 << ", id=" << rtc::hex_encode(id())
1134 << ", code=" << error_code->code() 1135 << ", code=" << error_code->code()
1135 << ", rtt=" << Elapsed(); 1136 << ", rtt=" << Elapsed();
1136 port_->OnAllocateError(); 1137 port_->OnAllocateError();
1137 } 1138 }
1138 } 1139 }
1139 1140
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 response->GetByteString(STUN_ATTR_NONCE); 1209 response->GetByteString(STUN_ATTR_NONCE);
1209 if (nonce_attr) { 1210 if (nonce_attr) {
1210 LOG_J(LS_INFO, port_) << "Applying STUN_ATTR_NONCE attribute in " 1211 LOG_J(LS_INFO, port_) << "Applying STUN_ATTR_NONCE attribute in "
1211 << "try alternate error response."; 1212 << "try alternate error response.";
1212 port_->set_nonce(nonce_attr->GetString()); 1213 port_->set_nonce(nonce_attr->GetString());
1213 } 1214 }
1214 1215
1215 // For TCP, we can't close the original Tcp socket during handling a 300 as 1216 // For TCP, we can't close the original Tcp socket during handling a 300 as
1216 // we're still inside that socket's event handler. Doing so will cause 1217 // we're still inside that socket's event handler. Doing so will cause
1217 // deadlock. 1218 // deadlock.
1218 port_->thread()->Post(port_, TurnPort::MSG_TRY_ALTERNATE_SERVER); 1219 port_->thread()->Post(RTC_FROM_HERE, port_,
1220 TurnPort::MSG_TRY_ALTERNATE_SERVER);
1219 } 1221 }
1220 1222
1221 TurnRefreshRequest::TurnRefreshRequest(TurnPort* port) 1223 TurnRefreshRequest::TurnRefreshRequest(TurnPort* port)
1222 : StunRequest(new TurnMessage()), 1224 : StunRequest(new TurnMessage()),
1223 port_(port), 1225 port_(port),
1224 lifetime_(-1) { 1226 lifetime_(-1) {
1225 } 1227 }
1226 1228
1227 void TurnRefreshRequest::Prepare(StunMessage* request) { 1229 void TurnRefreshRequest::Prepare(StunMessage* request) {
1228 // Create the request as indicated in RFC 5766, Section 7.1. 1230 // Create the request as indicated in RFC 5766, Section 7.1.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 } else { 1526 } else {
1525 state_ = STATE_UNBOUND; 1527 state_ = STATE_UNBOUND;
1526 port_->DestroyConnection(ext_addr_); 1528 port_->DestroyConnection(ext_addr_);
1527 } 1529 }
1528 } 1530 }
1529 void TurnEntry::OnChannelBindTimeout() { 1531 void TurnEntry::OnChannelBindTimeout() {
1530 state_ = STATE_UNBOUND; 1532 state_ = STATE_UNBOUND;
1531 port_->DestroyConnection(ext_addr_); 1533 port_->DestroyConnection(ext_addr_);
1532 } 1534 }
1533 } // namespace cricket 1535 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller_unittest.cc ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698