Index: webrtc/p2p/base/turnport.h |
diff --git a/webrtc/p2p/base/turnport.h b/webrtc/p2p/base/turnport.h |
index 5bb7558598fc233686b88c7cca17a303353ee950..4e34c7bdcf1a415b9e32fd8696dfc0277d35bdbf 100644 |
--- a/webrtc/p2p/base/turnport.h |
+++ b/webrtc/p2p/base/turnport.h |
@@ -31,6 +31,13 @@ extern const char TURN_PORT_TYPE[]; |
class TurnAllocateRequest; |
class TurnEntry; |
+enum PortState { |
+ DISCONNECTED, // No socket available, cannot send any packets. |
+ CONNECTING, // Socket available, can send stun packets only. |
+ CONNECTED // Socket available and allocation response received, |
+ // can send any packets. |
pthatcher1
2015/07/28 22:06:14
Unfortunately, these need a prefix, like PS_DISCON
honghaiz3
2015/07/29 21:44:13
Done.
|
+}; |
+ |
class TurnPort : public Port { |
public: |
static TurnPort* Create(rtc::Thread* thread, |
@@ -70,7 +77,7 @@ class TurnPort : public Port { |
// Returns an empty address if the local address has not been assigned. |
rtc::SocketAddress GetLocalAddress() const; |
- bool connected() const { return connected_; } |
+ bool connected() const { return port_state_ == CONNECTED; } |
const RelayCredentials& credentials() const { return credentials_; } |
virtual void PrepareAddress(); |
@@ -123,6 +130,8 @@ class TurnPort : public Port { |
// This signal is only for testing purpose. |
sigslot::signal3<TurnPort*, const rtc::SocketAddress&, int> |
SignalCreatePermissionResult; |
+ // For testing purpose. |
+ void SendAllocateRequest(int delay); |
protected: |
TurnPort(rtc::Thread* thread, |
@@ -225,7 +234,7 @@ class TurnPort : public Port { |
int next_channel_number_; |
EntryList entries_; |
- bool connected_; |
+ PortState port_state_; |
pthatcher1
2015/07/28 22:06:14
Just state_ would be fine.
honghaiz3
2015/07/29 21:44:13
Done.
|
// By default the value will be set to 0. This value will be used in |
// calculating the candidate priority. |
int server_priority_; |