Chromium Code Reviews| Index: webrtc/p2p/base/p2ptransportchannel.h |
| diff --git a/webrtc/p2p/base/p2ptransportchannel.h b/webrtc/p2p/base/p2ptransportchannel.h |
| index ada3ecfb8bb2deeb6bc5d9120eb1647d7cd1a1da..fd5d62c98ebce80f8b4a3d81eb75f5b918a9d142 100644 |
| --- a/webrtc/p2p/base/p2ptransportchannel.h |
| +++ b/webrtc/p2p/base/p2ptransportchannel.h |
| @@ -115,7 +115,7 @@ class P2PTransportChannel : public TransportChannelImpl, |
| int GetError() override { return error_; } |
| bool GetStats(std::vector<ConnectionInfo>* stats) override; |
| - const Connection* best_connection() const { return best_connection_; } |
| + const Connection* selected_connection() const { return selected_connection_; } |
| void set_incoming_only(bool value) { incoming_only_ = value; } |
| // Note: This is only for testing purpose. |
| @@ -208,7 +208,7 @@ class P2PTransportChannel : public TransportChannelImpl, |
| void UpdateConnectionStates(); |
| void RequestSort(); |
| void SortConnections(); |
| - void SwitchBestConnectionTo(Connection* conn); |
| + void SwitchSelectedConnection(Connection* conn); |
| void UpdateState(); |
| void HandleAllTimedOut(); |
| void MaybeStopPortAllocatorSessions(); |
| @@ -258,8 +258,10 @@ class P2PTransportChannel : public TransportChannelImpl, |
| void OnSort(); |
| void OnCheckAndPing(); |
| + bool ShouldSwitchOnNominatedOrDataReceived(Connection* new_connection) const; |
|
pthatcher1
2016/06/17 00:27:11
I still think ShouldSwitchSelectedCandidate makes
honghaiz3
2016/06/17 19:18:18
Done.
|
| + |
| void PruneConnections(); |
| - Connection* best_nominated_connection() const; |
| + Connection* selected_nominated_connection() const; |
| bool IsBackupConnection(Connection* conn) const; |
| Connection* FindConnectionToPing(int64_t now); |
| @@ -300,7 +302,7 @@ class P2PTransportChannel : public TransportChannelImpl, |
| std::vector<PortInterface *> ports_; |
| // |connections_| is a sorted list with the first one always be the |
| - // |best_connection_| when it's not nullptr. The combination of |
| + // |selected_connection_| when it's not nullptr. The combination of |
| // |pinged_connections_| and |unpinged_connections_| has the same |
| // connections as |connections_|. These 2 sets maintain whether a |
| // connection should be pinged next or not. |
| @@ -308,11 +310,15 @@ class P2PTransportChannel : public TransportChannelImpl, |
| std::set<Connection*> pinged_connections_; |
| std::set<Connection*> unpinged_connections_; |
| - Connection* best_connection_; |
| + Connection* selected_connection_ = nullptr; |
| + |
| + // Connection most recently nominated by the controlling agent. |
| + // This should be used only at the controlled side. |
| + Connection* last_nominated_connection_ = nullptr; |
| + // The connection on which the data was most recently received. |
| + // Should only be used at the controlled side. |
| + Connection* last_receiving_connection_ = nullptr; |
| - // Connection selected by the controlling agent. This should be used only |
| - // at controlled side when protocol type is RFC5245. |
| - Connection* pending_best_connection_; |
| std::vector<RemoteCandidate> remote_candidates_; |
| bool sort_dirty_; // indicates whether another sort is needed right now |
| bool had_connection_ = false; // if connections_ has ever been nonempty |