Index: webrtc/p2p/base/p2ptransportchannel.h |
diff --git a/webrtc/p2p/base/p2ptransportchannel.h b/webrtc/p2p/base/p2ptransportchannel.h |
index 692b09843bf7dbf470cc41a3972bd7a8f8fe03cf..6fafaa4c3ebdc1069ce39b8b1af1fad9631ed377 100644 |
--- a/webrtc/p2p/base/p2ptransportchannel.h |
+++ b/webrtc/p2p/base/p2ptransportchannel.h |
@@ -127,9 +127,10 @@ class P2PTransportChannel : public TransportChannelImpl, |
const Connection* selected_connection() const { return selected_connection_; } |
void set_incoming_only(bool value) { incoming_only_ = value; } |
- // Note: This is only for testing purpose. |
- // |ports_| should not be changed from outside. |
+ // Note: These are only for testing purpose. |
+ // |ports_| and |pruned_ports| should not be changed from outside. |
const std::vector<PortInterface*>& ports() { return ports_; } |
+ const std::vector<PortInterface*>& pruned_ports() { return pruned_ports_; } |
IceMode remote_ice_mode() const { return remote_ice_mode_; } |
@@ -184,6 +185,7 @@ class P2PTransportChannel : public TransportChannelImpl, |
return false; |
} |
+ void PruneAllPorts(); |
int receiving_timeout() const { return config_.receiving_timeout; } |
int check_receiving_interval() const { return check_receiving_interval_; } |
@@ -276,11 +278,8 @@ class P2PTransportChannel : public TransportChannelImpl, |
void AddConnection(Connection* connection); |
void OnPortReady(PortAllocatorSession *session, PortInterface* port); |
- // TODO(honghaiz): Merge the two methods OnPortsRemoved and OnPortPruned but |
- // still log the reason of removing. |
- void OnPortsRemoved(PortAllocatorSession* session, |
- const std::vector<PortInterface*>& ports); |
- void OnPortPruned(PortAllocatorSession* session, PortInterface* port); |
+ void OnPortsPruned(PortAllocatorSession* session, |
+ const std::vector<PortInterface*>& ports); |
void OnCandidatesReady(PortAllocatorSession *session, |
const std::vector<Candidate>& candidates); |
void OnCandidatesRemoved(PortAllocatorSession* session, |
@@ -294,11 +293,11 @@ class P2PTransportChannel : public TransportChannelImpl, |
bool port_muxed); |
// When a port is destroyed, remove it from both lists |ports_| |
- // and |removed_ports_|. |
+ // and |pruned_ports_|. |
void OnPortDestroyed(PortInterface* port); |
- // When removing a port, move it from |ports_| to |removed_ports_|. |
+ // When pruning a port, move it from |ports_| to |pruned_ports_|. |
// Returns true if the port is found and removed from |ports_|. |
- bool RemovePort(PortInterface* port); |
+ bool PrunePort(PortInterface* port); |
void OnRoleConflict(PortInterface* port); |
void OnConnectionStateChange(Connection* connection); |
@@ -366,11 +365,11 @@ class P2PTransportChannel : public TransportChannelImpl, |
// |ports_| contains ports that are used to form new connections when |
// new remote candidates are added. |
std::vector<PortInterface*> ports_; |
- // |removed_ports_| contains ports that have been removed from |ports_| and |
+ // |pruned_ports_| contains ports that have been removed from |ports_| and |
// are not being used to form new connections, but that aren't yet destroyed. |
// They may have existing connections, and they still fire signals such as |
// SignalUnknownAddress. |
- std::vector<PortInterface*> removed_ports_; |
+ std::vector<PortInterface*> pruned_ports_; |
// |connections_| is a sorted list with the first one always be the |
// |selected_connection_| when it's not nullptr. The combination of |