Index: webrtc/p2p/base/port.h |
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h |
index 06efd2d3c235c4e976fda6f610c187741ac7542f..8e8a2e09c31ede962b77581c8701e21953958232 100644 |
--- a/webrtc/p2p/base/port.h |
+++ b/webrtc/p2p/base/port.h |
@@ -178,7 +178,7 @@ class Port : public PortInterface, public rtc::MessageHandler, |
} |
// Identifies the generation that this port was created in. |
- uint32_t generation() { return generation_; } |
+ uint32_t generation() const { return generation_; } |
void set_generation(uint32_t generation) { generation_ = generation; } |
const std::string username_fragment() const; |
@@ -435,7 +435,7 @@ class Connection : public CandidatePairInterface, |
const Port* port() const { return port_; } |
// Implementation of virtual methods in CandidatePairInterface. |
- // Returns the description of the local port |
+ // Returns the description of the local port. |
virtual const Candidate& local_candidate() const; |
// Returns the description of the remote port to which we communicate. |
virtual const Candidate& remote_candidate() const; |
@@ -444,14 +444,22 @@ class Connection : public CandidatePairInterface, |
uint64_t priority() const; |
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_WRITABLE = 0, // We have received ping responses recently. |
+ STATE_PRESUMED_WRITABLE = 1, // We haven't received a ping response, but |
+ // we presume we're writable, because we're a |
+ // TURN-TURN connection and CreatePermission |
+ // isn't required. |
+ 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. |
}; |
WriteState write_state() const { return write_state_; } |
bool writable() const { return write_state_ == STATE_WRITABLE; } |
+ bool presumed_writable() const { |
honghaiz3
2016/06/17 01:55:03
When do we need to differentiate presumed_writable
Taylor Brandstetter
2016/06/20 17:15:45
There are a few notable places. For example, the l
honghaiz3
2016/06/20 22:31:03
If I understand correctly, that is the only place
pthatcher1
2016/06/21 06:20:50
The problem is that if someone calls writable() an
Taylor Brandstetter
2016/06/22 00:37:07
My reasoning:
1. I don't want to change the meani
|
+ return write_state_ == STATE_WRITABLE || |
+ write_state_ == STATE_PRESUMED_WRITABLE; |
+ } |
bool receiving() const { return receiving_; } |
// Determines whether the connection has finished connecting. This can only |
@@ -589,7 +597,10 @@ class Connection : public CandidatePairInterface, |
enum { MSG_DELETE = 0, MSG_FIRST_AVAILABLE }; |
// Constructs a new connection to the given remote port. |
- Connection(Port* port, size_t index, const Candidate& candidate); |
+ Connection(Port* port, |
+ size_t index, |
+ const Candidate& candidate, |
+ const IceConfig& config); |
// Called back when StunRequestManager has a stun packet to send |
void OnSendStunPacket(const void* data, size_t size, StunRequest* req); |
@@ -602,6 +613,10 @@ class Connection : public CandidatePairInterface, |
void OnConnectionRequestTimeout(ConnectionRequest* req); |
void OnConnectionRequestSent(ConnectionRequest* req); |
+ // May be STATE_WRITE_INIT or STATE_PRESUMED_WRITABLE depending on ICE |
+ // config and candidate types. |
+ WriteState InitialWriteState() const; |
+ |
// Changes the state and signals if necessary. |
void set_write_state(WriteState value); |
void set_receiving(bool value); |
@@ -650,6 +665,7 @@ class Connection : public CandidatePairInterface, |
int receiving_timeout_; |
int64_t time_created_ms_; |
int num_pings_sent_ = 0; |
+ bool fully_relayed_createpermission_needed_; |
friend class Port; |
friend class ConnectionRequest; |
@@ -658,7 +674,10 @@ class Connection : public CandidatePairInterface, |
// ProxyConnection defers all the interesting work to the port. |
class ProxyConnection : public Connection { |
public: |
- ProxyConnection(Port* port, size_t index, const Candidate& remote_candidate); |
+ ProxyConnection(Port* port, |
+ size_t index, |
+ const Candidate& remote_candidate, |
+ const IceConfig& config); |
int Send(const void* data, |
size_t size, |