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

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

Issue 2171183002: Remove ports that are not used by any channel after timeout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: fix a comment Created 4 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/port.h
diff --git a/webrtc/p2p/base/port.h b/webrtc/p2p/base/port.h
index 37926c955603a3f27918270b5b43b177cdccddf9..f9f343726d8ce2fd0288926c51763b8105276cfc 100644
--- a/webrtc/p2p/base/port.h
+++ b/webrtc/p2p/base/port.h
@@ -153,6 +153,9 @@ class Port : public PortInterface, public rtc::MessageHandler,
virtual bool SharedSocket() const { return shared_socket_; }
void ResetSharedSocket() { shared_socket_ = false; }
+ virtual void StartBeingUsed();
+ virtual void StopBeingUsed();
pthatcher1 2016/07/27 18:33:15 As we talked in person, would it make sense to jus
honghaiz3 2016/07/28 01:22:49 Done.
+
// The thread on which this port performs its I/O.
rtc::Thread* thread() { return thread_; }
@@ -297,10 +300,7 @@ class Port : public PortInterface, public rtc::MessageHandler,
int16_t network_cost() const { return network_cost_; }
protected:
- enum {
- MSG_DEAD = 0,
- MSG_FIRST_AVAILABLE
- };
+ enum { MSG_CHECK_DEAD = 0, MSG_FIRST_AVAILABLE };
virtual void UpdateNetworkCost();
@@ -357,11 +357,8 @@ class Port : public PortInterface, public rtc::MessageHandler,
// Called when one of our connections deletes itself.
void OnConnectionDestroyed(Connection* conn);
- // Whether this port is dead, and hence, should be destroyed on the controlled
- // side.
- bool dead() const {
- return ice_role_ == ICEROLE_CONTROLLED && connections_.empty();
- }
+ // Whether this port is dead, and hence, should be destroyed.
+ bool dead() const;
void OnNetworkTypeChanged(const rtc::Network* network);
@@ -401,6 +398,10 @@ class Port : public PortInterface, public rtc::MessageHandler,
// (WiFi. vs. Cellular). It takes precedence over the priority when
// comparing two connections.
uint16_t network_cost_;
+ // Whether a port is being used by a transport channel. A port should not be
+ // destroyed if it is being used.
+ bool is_used_ = false;
pthatcher1 2016/07/27 18:33:15 Maybe we can just use !pruned_ && !candidates_.emp
honghaiz3 2016/07/28 01:22:49 I think you said better to have state. Removed "is
+ int64_t last_time_all_connections_removed_ = 0;
pthatcher1 2016/07/27 18:33:15 Can you move this "fix" for the timing of deletion
honghaiz3 2016/07/28 01:22:49 Done.
friend class Connection;
};

Powered by Google App Engine
This is Rietveld 408576698