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

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

Issue 2069493002: Do not switch best connection on the controlled side too frequently (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comments Created 4 years, 6 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 | « no previous file | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | webrtc/p2p/base/p2ptransportchannel.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | webrtc/p2p/base/p2ptransportchannel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698