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

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: 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
« no previous file with comments | « webrtc/base/asynctcpsocket.cc ('k') | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/turnport.h
diff --git a/webrtc/p2p/base/turnport.h b/webrtc/p2p/base/turnport.h
index 5bb7558598fc233686b88c7cca17a303353ee950..52546e09a3d8efb162833c57dae8383f97dec367 100644
--- a/webrtc/p2p/base/turnport.h
+++ b/webrtc/p2p/base/turnport.h
@@ -33,6 +33,12 @@ class TurnEntry;
class TurnPort : public Port {
public:
+ enum PortState {
+ STATE_CONNECTING, // Initial state, cannot send any packets.
+ STATE_CONNECTED, // Socket connected, ready to send stun requests.
+ STATE_READY, // Received allocate success, can send any packets.
+ STATE_DISCONNECTED, // TCP connection died, cannot send any packets.
+ };
static TurnPort* Create(rtc::Thread* thread,
rtc::PacketSocketFactory* factory,
rtc::Network* network,
@@ -70,7 +76,10 @@ 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 ready() const { return state_ == STATE_READY; }
+ bool connected() const {
+ return state_ == STATE_READY || state_ == STATE_CONNECTED;
+ }
const RelayCredentials& credentials() const { return credentials_; }
virtual void PrepareAddress();
@@ -225,7 +234,7 @@ class TurnPort : public Port {
int next_channel_number_;
EntryList entries_;
- bool connected_;
+ PortState state_;
// By default the value will be set to 0. This value will be used in
// calculating the candidate priority.
int server_priority_;
« no previous file with comments | « webrtc/base/asynctcpsocket.cc ('k') | webrtc/p2p/base/turnport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698