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

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

Issue 1247573002: Fix a Turn TCP port issue. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Slight change in asynctcpsocket.cc Created 5 years, 5 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/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_;

Powered by Google App Engine
This is Rietveld 408576698