Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (!connection->weak() && |
| 1408 connection->local_candidate().generation() >= | |
| 1409 allocator_session()->generation()) { | |
|
pthatcher1
2016/04/11 19:35:21
Can you make a variable to improve readability?
b
honghaiz3
2016/04/18 23:50:24
Done.
| |
| 1407 MaybeStopPortAllocatorSessions(); | 1410 MaybeStopPortAllocatorSessions(); |
| 1408 } | 1411 } |
| 1409 | 1412 |
| 1410 // We have to unroll the stack before doing this because we may be changing | 1413 // We have to unroll the stack before doing this because we may be changing |
| 1411 // the state of connections while sorting. | 1414 // the state of connections while sorting. |
| 1412 RequestSort(); | 1415 RequestSort(); |
| 1413 } | 1416 } |
| 1414 | 1417 |
| 1415 // When a connection is removed, edit it out, and then update our best | 1418 // When a connection is removed, edit it out, and then update our best |
| 1416 // connection. | 1419 // connection. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1633 | 1636 |
| 1634 // During the initial state when nothing has been pinged yet, return the first | 1637 // During the initial state when nothing has been pinged yet, return the first |
| 1635 // one in the ordered |connections_|. | 1638 // one in the ordered |connections_|. |
| 1636 return *(std::find_if(connections_.begin(), connections_.end(), | 1639 return *(std::find_if(connections_.begin(), connections_.end(), |
| 1637 [conn1, conn2](Connection* conn) { | 1640 [conn1, conn2](Connection* conn) { |
| 1638 return conn == conn1 || conn == conn2; | 1641 return conn == conn1 || conn == conn2; |
| 1639 })); | 1642 })); |
| 1640 } | 1643 } |
| 1641 | 1644 |
| 1642 } // namespace cricket | 1645 } // namespace cricket |
| OLD | NEW |