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

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

Issue 1311433009: A few updates on connection states (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge and address comments Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/port.h
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h
index 8e7a2592d991661c59bc745e901d523c5b1dd9a8..9a6003c933a3188a5d99da787f2db3e0d94cb24e 100644
--- a/webrtc/p2p/base/port.h
+++ b/webrtc/p2p/base/port.h
@@ -60,6 +60,9 @@ const uint32 WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds
// The length of time we wait before timing out writability on a connection.
const uint32 CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds
+// The length of time we wait before the write state become stale.
+const uint32 CONNECTION_WRITE_STALE_TIMEOUT = 10 * 1000; // 10 seconds
+
// The length of time we wait before we become unwritable.
const uint32 CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds
@@ -423,13 +426,15 @@ class Connection : public rtc::MessageHandler,
enum WriteState {
STATE_WRITABLE = 0, // we have received ping responses recently
- STATE_WRITE_UNRELIABLE = 1, // we have had a few ping failures
- STATE_WRITE_INIT = 2, // we have yet to receive a ping response
- STATE_WRITE_TIMEOUT = 3, // we have had a large number of ping failures
+ STATE_WRITE_STALE = 1, // we have not sent ping recently.
+ STATE_WRITE_UNRELIABLE = 2, // we have had a few ping failures
+ STATE_WRITE_INIT = 3, // we have yet to receive a ping response
+ STATE_WRITE_TIMEOUT = 4, // we have had a large number of ping failures
pthatcher1 2015/09/21 23:49:18 So the only difference between STALE and UNRELIABL
honghaiz3 2015/09/22 19:35:08 Dropped this change now.
};
WriteState write_state() const { return write_state_; }
bool writable() const { return write_state_ == STATE_WRITABLE; }
+ bool write_timed_out() const { return write_state_ == STATE_WRITE_TIMEOUT; }
bool receiving() const { return receiving_; }
// Determines whether the connection has finished connecting. This can only
@@ -480,6 +485,7 @@ class Connection : public rtc::MessageHandler,
// side stops using it as well.
bool pruned() const { return pruned_; }
void Prune();
+ void Unprune();
bool use_candidate_attr() const { return use_candidate_attr_; }
void set_use_candidate_attr(bool enable);
@@ -570,9 +576,6 @@ class Connection : public rtc::MessageHandler,
void set_state(State state);
void set_connected(bool value);
- // Checks if this connection is useless, and hence, should be destroyed.
- void CheckTimeout();
-
void OnMessage(rtc::Message *pmsg);
Port* port_;
@@ -593,6 +596,7 @@ class Connection : public rtc::MessageHandler,
IceMode remote_ice_mode_;
StunRequestManager requests_;
uint32 rtt_;
+ uint32 time_created_;
uint32 last_ping_sent_; // last time we sent a ping to the other side
uint32 last_ping_received_; // last time we received a ping from the other
// side

Powered by Google App Engine
This is Rietveld 408576698