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

Side by Side Diff: webrtc/p2p/base/p2ptransportchannel.h

Issue 2369963004: Ping the premier connection on each network with higher priority. (Closed)
Patch Set: . Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 #include "webrtc/base/asyncpacketsocket.h" 36 #include "webrtc/base/asyncpacketsocket.h"
37 #include "webrtc/base/sigslot.h" 37 #include "webrtc/base/sigslot.h"
38 38
39 namespace cricket { 39 namespace cricket {
40 40
41 // Enum for UMA metrics, used to record whether the channel is 41 // Enum for UMA metrics, used to record whether the channel is
42 // connected/connecting/disconnected when ICE restart happens. 42 // connected/connecting/disconnected when ICE restart happens.
43 enum class IceRestartState { CONNECTING, CONNECTED, DISCONNECTED, MAX_VALUE }; 43 enum class IceRestartState { CONNECTING, CONNECTED, DISCONNECTED, MAX_VALUE };
44 44
45 extern const int WEAK_PING_INTERVAL; 45 extern const int WEAK_PING_INTERVAL;
46 extern const int STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL; 46 extern const int WEAK_OR_STABILIZING_WRITABLE_CONNECTION_PING_INTERVAL;
47 extern const int STABLE_WRITABLE_CONNECTION_PING_INTERVAL; 47 extern const int STRONG_AND_STABLE_WRITABLE_CONNECTION_PING_INTERVAL;
48 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3; 48 static const int MIN_PINGS_AT_WEAK_PING_INTERVAL = 3;
49 49
50 // Adds the port on which the candidate originated. 50 // Adds the port on which the candidate originated.
51 class RemoteCandidate : public Candidate { 51 class RemoteCandidate : public Candidate {
52 public: 52 public:
53 RemoteCandidate(const Candidate& c, PortInterface* origin_port) 53 RemoteCandidate(const Candidate& c, PortInterface* origin_port)
54 : Candidate(c), origin_port_(origin_port) {} 54 : Candidate(c), origin_port_(origin_port) {}
55 55
56 PortInterface* origin_port() { return origin_port_; } 56 PortInterface* origin_port() { return origin_port_; }
57 57
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 bool CreateConnection(PortInterface* port, 254 bool CreateConnection(PortInterface* port,
255 const Candidate& remote_candidate, 255 const Candidate& remote_candidate,
256 PortInterface* origin_port); 256 PortInterface* origin_port);
257 bool FindConnection(cricket::Connection* connection) const; 257 bool FindConnection(cricket::Connection* connection) const;
258 258
259 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate); 259 uint32_t GetRemoteCandidateGeneration(const Candidate& candidate);
260 bool IsDuplicateRemoteCandidate(const Candidate& candidate); 260 bool IsDuplicateRemoteCandidate(const Candidate& candidate);
261 void RememberRemoteCandidate(const Candidate& remote_candidate, 261 void RememberRemoteCandidate(const Candidate& remote_candidate,
262 PortInterface* origin_port); 262 PortInterface* origin_port);
263 bool IsPingable(const Connection* conn, int64_t now) const; 263 bool IsPingable(const Connection* conn, int64_t now) const;
264 bool IsSelectedConnectionPingable(int64_t now); 264 // Whether the best connection on its network is pingable.
265 bool IsPerNetworkBestConnectionPingable(Connection* best_conn, int64_t now);
pthatcher1 2016/10/25 17:00:06 I still think you could just say "IsConnectionPing
honghaiz3 2016/10/25 18:01:09 There is a method above called IsPingable, which i
265 int CalculateActiveWritablePingInterval(const Connection* conn, 266 int CalculateActiveWritablePingInterval(const Connection* conn,
266 int64_t now) const; 267 int64_t now) const;
267 void PingConnection(Connection* conn); 268 void PingConnection(Connection* conn);
268 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); 269 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session);
269 void AddConnection(Connection* connection); 270 void AddConnection(Connection* connection);
270 271
271 void OnPortReady(PortAllocatorSession *session, PortInterface* port); 272 void OnPortReady(PortAllocatorSession *session, PortInterface* port);
272 void OnPortsPruned(PortAllocatorSession* session, 273 void OnPortsPruned(PortAllocatorSession* session,
273 const std::vector<PortInterface*>& ports); 274 const std::vector<PortInterface*>& ports);
274 void OnCandidatesReady(PortAllocatorSession *session, 275 void OnCandidatesReady(PortAllocatorSession *session,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 // Returns true if we should switch to the new connection. 311 // Returns true if we should switch to the new connection.
311 // sets |missed_receiving_unchanged_threshold| to true if either 312 // sets |missed_receiving_unchanged_threshold| to true if either
312 // the selected connection or the new connection missed its 313 // the selected connection or the new connection missed its
313 // receiving-unchanged-threshold. 314 // receiving-unchanged-threshold.
314 bool ShouldSwitchSelectedConnection( 315 bool ShouldSwitchSelectedConnection(
315 Connection* new_connection, 316 Connection* new_connection,
316 bool* missed_receiving_unchanged_threshold) const; 317 bool* missed_receiving_unchanged_threshold) const;
317 // Returns true if the new_connection is selected for transmission. 318 // Returns true if the new_connection is selected for transmission.
318 bool MaybeSwitchSelectedConnection(Connection* new_connection, 319 bool MaybeSwitchSelectedConnection(Connection* new_connection,
319 const std::string& reason); 320 const std::string& reason);
320 321 // Gets all best connections on every network.
pthatcher1 2016/10/25 17:00:06 Better phrased as "Get the best connection for eac
honghaiz3 2016/10/25 18:01:09 Done.
322 std::map<rtc::Network*, Connection*> GetBestConnectionsByNetwork() const;
pthatcher1 2016/10/25 17:00:06 GetBestConnectionByNetwork (makes it clear there i
honghaiz3 2016/10/25 18:01:09 Done.
321 void PruneConnections(); 323 void PruneConnections();
322 bool IsBackupConnection(const Connection* conn) const; 324 bool IsBackupConnection(const Connection* conn) const;
323 325
324 Connection* FindConnectionToPing(int64_t now); 326 Connection* FindConnectionToPing(int64_t now);
325 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now); 327 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now);
326 // Between |conn1| and |conn2|, this function returns the one which should 328 // Between |conn1| and |conn2|, this function returns the one which should
327 // be pinged first. 329 // be pinged first.
328 Connection* SelectMostPingableConnection(Connection* conn1, 330 Connection* SelectMostPingableConnection(Connection* conn1,
329 Connection* conn2); 331 Connection* conn2);
330 // Select the connection which is Relay/Relay. If both of them are, 332 // Select the connection which is Relay/Relay. If both of them are,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 uint32_t nomination_ = 0; 402 uint32_t nomination_ = 0;
401 403
402 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; 404 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
403 405
404 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 406 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
405 }; 407 };
406 408
407 } // namespace cricket 409 } // namespace cricket
408 410
409 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 411 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698