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

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

Issue 1857453002: Do not stop a session unless the candidate of a writable connection belongs to the (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add variables to improve readability Created 4 years, 8 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 | « no previous file | webrtc/p2p/base/p2ptransportchannel_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 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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 if (ice_role_ == ICEROLE_CONTROLLED) { 1393 if (ice_role_ == ICEROLE_CONTROLLED) {
1394 if (connection == pending_best_connection_ && connection->writable()) { 1394 if (connection == pending_best_connection_ && connection->writable()) {
1395 pending_best_connection_ = NULL; 1395 pending_best_connection_ = NULL;
1396 LOG(LS_INFO) << "Switching best connection on controlled side" 1396 LOG(LS_INFO) << "Switching best connection on controlled side"
1397 << " because it's now writable: " << connection->ToString(); 1397 << " because it's now writable: " << connection->ToString();
1398 SwitchBestConnectionTo(connection); 1398 SwitchBestConnectionTo(connection);
1399 } 1399 }
1400 } 1400 }
1401 1401
1402 // May stop the allocator session when at least one connection becomes 1402 // May stop the allocator session when at least one connection becomes
1403 // strongly connected after starting to get ports. It is not enough to check 1403 // strongly connected after starting to get ports and the local candidate of
1404 // the connection is at the latest generation. It is not enough to check
1404 // that the connection becomes weakly connected because the connection may be 1405 // that the connection becomes weakly connected because the connection may be
1405 // changing from (writable, receiving) to (writable, not receiving). 1406 // changing from (writable, receiving) to (writable, not receiving).
1406 if (!connection->weak()) { 1407 bool strongly_connected = !connection->weak();
1408 bool latest_generation = connection->local_candidate().generation() >=
1409 allocator_session()->generation();
1410 if (strongly_connected && latest_generation) {
1407 MaybeStopPortAllocatorSessions(); 1411 MaybeStopPortAllocatorSessions();
1408 } 1412 }
1409 1413
1410 // We have to unroll the stack before doing this because we may be changing 1414 // We have to unroll the stack before doing this because we may be changing
1411 // the state of connections while sorting. 1415 // the state of connections while sorting.
1412 RequestSort(); 1416 RequestSort();
1413 } 1417 }
1414 1418
1415 // When a connection is removed, edit it out, and then update our best 1419 // When a connection is removed, edit it out, and then update our best
1416 // connection. 1420 // connection.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 1637
1634 // During the initial state when nothing has been pinged yet, return the first 1638 // During the initial state when nothing has been pinged yet, return the first
1635 // one in the ordered |connections_|. 1639 // one in the ordered |connections_|.
1636 return *(std::find_if(connections_.begin(), connections_.end(), 1640 return *(std::find_if(connections_.begin(), connections_.end(),
1637 [conn1, conn2](Connection* conn) { 1641 [conn1, conn2](Connection* conn) {
1638 return conn == conn1 || conn == conn2; 1642 return conn == conn1 || conn == conn2;
1639 })); 1643 }));
1640 } 1644 }
1641 1645
1642 } // namespace cricket 1646 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698