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

Unified Diff: webrtc/p2p/base/port.cc

Issue 1544003002: Delete a connection after it is pruned or becomes write_timeout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/port_unittest.cc » ('j') | webrtc/p2p/base/port_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/port.cc
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc
index ddf38dcb189cfe90e1a1ecfa0278a8837d109271..02c67e0c26b1be5fea3608823b7a0b4d9386e749 100644
--- a/webrtc/p2p/base/port.cc
+++ b/webrtc/p2p/base/port.cc
@@ -1124,12 +1124,14 @@ void Connection::ReceivedPingResponse() {
}
bool Connection::dead(uint32_t now) const {
- if (now < (time_created_ms_ + MIN_CONNECTION_LIFETIME)) {
- // A connection that hasn't passed its minimum lifetime is still alive.
- // We do this to prevent connections from being pruned too quickly
- // during a network change event when two networks would be up
- // simultaneously but only for a brief period.
- return false;
+ if (last_received() == 0) {
+ // If a connection has never received anything, it will be dead only if
+ // it is inactive and has passed its minimum lifetime. We do this to prevent
+ // a connection may be deleted too quickly because it has not got a chance
+ // to be pinged, or it may be pruned too quickly during a network change
+ // event when two networks would be up simultaneously but only for a
+ // brief period.
+ return !active() && now > (time_created_ms_ + MIN_CONNECTION_LIFETIME);
}
pthatcher1 2015/12/30 17:12:28 Let me see if I understand the purpose of this CL
honghaiz3 2015/12/30 19:38:18 Yes. More precisely, having 10 seconds for the min
// It is dead if it has not received anything for
« no previous file with comments | « no previous file | webrtc/p2p/base/port_unittest.cc » ('j') | webrtc/p2p/base/port_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698