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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel.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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 void P2PTransportChannel::Connect() { 449 void P2PTransportChannel::Connect() {
450 ASSERT(worker_thread_ == rtc::Thread::Current()); 450 ASSERT(worker_thread_ == rtc::Thread::Current());
451 if (ice_ufrag_.empty() || ice_pwd_.empty()) { 451 if (ice_ufrag_.empty() || ice_pwd_.empty()) {
452 ASSERT(false); 452 ASSERT(false);
453 LOG(LS_ERROR) << "P2PTransportChannel::Connect: The ice_ufrag_ and the " 453 LOG(LS_ERROR) << "P2PTransportChannel::Connect: The ice_ufrag_ and the "
454 << "ice_pwd_ are not set."; 454 << "ice_pwd_ are not set.";
455 return; 455 return;
456 } 456 }
457 457
458 // Start checking and pinging as the ports come in. 458 // Start checking and pinging as the ports come in.
459 thread()->Post(this, MSG_CHECK_AND_PING); 459 thread()->Post(FROM_HERE, this, MSG_CHECK_AND_PING);
460 } 460 }
461 461
462 void P2PTransportChannel::MaybeStartGathering() { 462 void P2PTransportChannel::MaybeStartGathering() {
463 // Start gathering if we never started before, or if an ICE restart occurred. 463 // Start gathering if we never started before, or if an ICE restart occurred.
464 if (allocator_sessions_.empty() || 464 if (allocator_sessions_.empty() ||
465 IceCredentialsChanged(allocator_sessions_.back()->ice_ufrag(), 465 IceCredentialsChanged(allocator_sessions_.back()->ice_ufrag(),
466 allocator_sessions_.back()->ice_pwd(), ice_ufrag_, 466 allocator_sessions_.back()->ice_pwd(), ice_ufrag_,
467 ice_pwd_)) { 467 ice_pwd_)) {
468 if (gathering_state_ != kIceGatheringGathering) { 468 if (gathering_state_ != kIceGatheringGathering) {
469 gathering_state_ = kIceGatheringGathering; 469 gathering_state_ = kIceGatheringGathering;
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 1059
1060 // We need to copy the list of connections since some may delete themselves 1060 // We need to copy the list of connections since some may delete themselves
1061 // when we call UpdateState. 1061 // when we call UpdateState.
1062 for (size_t i = 0; i < connections_.size(); ++i) 1062 for (size_t i = 0; i < connections_.size(); ++i)
1063 connections_[i]->UpdateState(now); 1063 connections_[i]->UpdateState(now);
1064 } 1064 }
1065 1065
1066 // Prepare for best candidate sorting. 1066 // Prepare for best candidate sorting.
1067 void P2PTransportChannel::RequestSort() { 1067 void P2PTransportChannel::RequestSort() {
1068 if (!sort_dirty_) { 1068 if (!sort_dirty_) {
1069 worker_thread_->Post(this, MSG_SORT); 1069 worker_thread_->Post(FROM_HERE, this, MSG_SORT);
1070 sort_dirty_ = true; 1070 sort_dirty_ = true;
1071 } 1071 }
1072 } 1072 }
1073 1073
1074 // Sort the available connections to find the best one. We also monitor 1074 // Sort the available connections to find the best one. We also monitor
1075 // the number of available connections and the current state. 1075 // the number of available connections and the current state.
1076 void P2PTransportChannel::SortConnections() { 1076 void P2PTransportChannel::SortConnections() {
1077 ASSERT(worker_thread_ == rtc::Thread::Current()); 1077 ASSERT(worker_thread_ == rtc::Thread::Current());
1078 1078
1079 // Make sure the connection states are up-to-date since this affects how they 1079 // Make sure the connection states are up-to-date since this affects how they
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 // switch to weak ping interval. 1301 // switch to weak ping interval.
1302 int ping_interval = weak() ? weak_ping_interval_ : STRONG_PING_INTERVAL; 1302 int ping_interval = weak() ? weak_ping_interval_ : STRONG_PING_INTERVAL;
1303 if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) { 1303 if (rtc::TimeMillis() >= last_ping_sent_ms_ + ping_interval) {
1304 Connection* conn = FindNextPingableConnection(); 1304 Connection* conn = FindNextPingableConnection();
1305 if (conn) { 1305 if (conn) {
1306 PingConnection(conn); 1306 PingConnection(conn);
1307 MarkConnectionPinged(conn); 1307 MarkConnectionPinged(conn);
1308 } 1308 }
1309 } 1309 }
1310 int delay = std::min(ping_interval, check_receiving_interval_); 1310 int delay = std::min(ping_interval, check_receiving_interval_);
1311 thread()->PostDelayed(delay, this, MSG_CHECK_AND_PING); 1311 thread()->PostDelayed(FROM_HERE, delay, this, MSG_CHECK_AND_PING);
1312 } 1312 }
1313 1313
1314 // A connection is considered a backup connection if the channel state 1314 // A connection is considered a backup connection if the channel state
1315 // is completed, the connection is not the best connection and it is active. 1315 // is completed, the connection is not the best connection and it is active.
1316 bool P2PTransportChannel::IsBackupConnection(Connection* conn) const { 1316 bool P2PTransportChannel::IsBackupConnection(Connection* conn) const {
1317 return state_ == STATE_COMPLETED && conn != best_connection_ && 1317 return state_ == STATE_COMPLETED && conn != best_connection_ &&
1318 conn->active(); 1318 conn->active();
1319 } 1319 }
1320 1320
1321 // Is the connection in a state for us to even consider pinging the other side? 1321 // Is the connection in a state for us to even consider pinging the other side?
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 1658
1659 // During the initial state when nothing has been pinged yet, return the first 1659 // During the initial state when nothing has been pinged yet, return the first
1660 // one in the ordered |connections_|. 1660 // one in the ordered |connections_|.
1661 return *(std::find_if(connections_.begin(), connections_.end(), 1661 return *(std::find_if(connections_.begin(), connections_.end(),
1662 [conn1, conn2](Connection* conn) { 1662 [conn1, conn2](Connection* conn) {
1663 return conn == conn1 || conn == conn2; 1663 return conn == conn1 || conn == conn2;
1664 })); 1664 }));
1665 } 1665 }
1666 1666
1667 } // namespace cricket 1667 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698