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

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

Issue 2068263003: Do not delete a connection in the turn port with permission error or refresh error. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address Taylor's comment and merge 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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 // how a TCP connection is kicked into reconnecting on the active side. 1367 // how a TCP connection is kicked into reconnecting on the active side.
1368 bool P2PTransportChannel::IsPingable(Connection* conn, int64_t now) { 1368 bool P2PTransportChannel::IsPingable(Connection* conn, int64_t now) {
1369 const Candidate& remote = conn->remote_candidate(); 1369 const Candidate& remote = conn->remote_candidate();
1370 // We should never get this far with an empty remote ufrag. 1370 // We should never get this far with an empty remote ufrag.
1371 ASSERT(!remote.username().empty()); 1371 ASSERT(!remote.username().empty());
1372 if (remote.username().empty() || remote.password().empty()) { 1372 if (remote.username().empty() || remote.password().empty()) {
1373 // If we don't have an ICE ufrag and pwd, there's no way we can ping. 1373 // If we don't have an ICE ufrag and pwd, there's no way we can ping.
1374 return false; 1374 return false;
1375 } 1375 }
1376 1376
1377 // A failed connection will not be pinged.
1378 if (conn->state() == Connection::STATE_FAILED) {
1379 return false;
1380 }
1381
1377 // An never connected connection cannot be written to at all, so pinging is 1382 // An never connected connection cannot be written to at all, so pinging is
1378 // out of the question. However, if it has become WRITABLE, it is in the 1383 // out of the question. However, if it has become WRITABLE, it is in the
1379 // reconnecting state so ping is needed. 1384 // reconnecting state so ping is needed.
1380 if (!conn->connected() && !conn->writable()) { 1385 if (!conn->connected() && !conn->writable()) {
1381 return false; 1386 return false;
1382 } 1387 }
1383 1388
1384 // If the channel is weakly connected, ping all connections. 1389 // If the channel is weakly connected, ping all connections.
1385 if (weak()) { 1390 if (weak()) {
1386 return true; 1391 return true;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 1740
1736 // During the initial state when nothing has been pinged yet, return the first 1741 // During the initial state when nothing has been pinged yet, return the first
1737 // one in the ordered |connections_|. 1742 // one in the ordered |connections_|.
1738 return *(std::find_if(connections_.begin(), connections_.end(), 1743 return *(std::find_if(connections_.begin(), connections_.end(),
1739 [conn1, conn2](Connection* conn) { 1744 [conn1, conn2](Connection* conn) {
1740 return conn == conn1 || conn == conn2; 1745 return conn == conn1 || conn == conn2;
1741 })); 1746 }));
1742 } 1747 }
1743 1748
1744 } // namespace cricket 1749 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698