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 |