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

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

Issue 2369963004: Ping the premier connection on each network with higher priority. (Closed)
Patch Set: Add a header file <iterator> 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
« no previous file with comments | « webrtc/base/firewallsocketserver.cc ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a writable connection is past its ping interval and needs to be
265 // pinged again.
266 bool WritableConnectionPastPingInterval(const Connection* conn,
267 int64_t now) const;
265 int CalculateActiveWritablePingInterval(const Connection* conn, 268 int CalculateActiveWritablePingInterval(const Connection* conn,
266 int64_t now) const; 269 int64_t now) const;
267 void PingConnection(Connection* conn); 270 void PingConnection(Connection* conn);
268 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session); 271 void AddAllocatorSession(std::unique_ptr<PortAllocatorSession> session);
269 void AddConnection(Connection* connection); 272 void AddConnection(Connection* connection);
270 273
271 void OnPortReady(PortAllocatorSession *session, PortInterface* port); 274 void OnPortReady(PortAllocatorSession *session, PortInterface* port);
272 void OnPortsPruned(PortAllocatorSession* session, 275 void OnPortsPruned(PortAllocatorSession* session,
273 const std::vector<PortInterface*>& ports); 276 const std::vector<PortInterface*>& ports);
274 void OnCandidatesReady(PortAllocatorSession *session, 277 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. 313 // Returns true if we should switch to the new connection.
311 // sets |missed_receiving_unchanged_threshold| to true if either 314 // sets |missed_receiving_unchanged_threshold| to true if either
312 // the selected connection or the new connection missed its 315 // the selected connection or the new connection missed its
313 // receiving-unchanged-threshold. 316 // receiving-unchanged-threshold.
314 bool ShouldSwitchSelectedConnection( 317 bool ShouldSwitchSelectedConnection(
315 Connection* new_connection, 318 Connection* new_connection,
316 bool* missed_receiving_unchanged_threshold) const; 319 bool* missed_receiving_unchanged_threshold) const;
317 // Returns true if the new_connection is selected for transmission. 320 // Returns true if the new_connection is selected for transmission.
318 bool MaybeSwitchSelectedConnection(Connection* new_connection, 321 bool MaybeSwitchSelectedConnection(Connection* new_connection,
319 const std::string& reason); 322 const std::string& reason);
320 323 // Gets the best connection for each network.
324 std::map<rtc::Network*, Connection*> GetBestConnectionByNetwork() const;
325 std::vector<Connection*> GetBestWritableConnectionPerNetwork() const;
321 void PruneConnections(); 326 void PruneConnections();
322 bool IsBackupConnection(const Connection* conn) const; 327 bool IsBackupConnection(const Connection* conn) const;
323 328
324 Connection* FindConnectionToPing(int64_t now);
325 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now); 329 Connection* FindOldestConnectionNeedingTriggeredCheck(int64_t now);
326 // Between |conn1| and |conn2|, this function returns the one which should 330 // Between |conn1| and |conn2|, this function returns the one which should
327 // be pinged first. 331 // be pinged first.
328 Connection* SelectMostPingableConnection(Connection* conn1, 332 Connection* MorePingable(Connection* conn1, Connection* conn2);
329 Connection* conn2);
330 // Select the connection which is Relay/Relay. If both of them are, 333 // Select the connection which is Relay/Relay. If both of them are,
331 // UDP relay protocol takes precedence. 334 // UDP relay protocol takes precedence.
332 Connection* MostLikelyToWork(Connection* conn1, Connection* conn2); 335 Connection* MostLikelyToWork(Connection* conn1, Connection* conn2);
333 // Compare the last_ping_sent time and return the one least recently pinged. 336 // Compare the last_ping_sent time and return the one least recently pinged.
334 Connection* LeastRecentlyPinged(Connection* conn1, Connection* conn2); 337 Connection* LeastRecentlyPinged(Connection* conn1, Connection* conn2);
335 338
336 // Returns the latest remote ICE parameters or nullptr if there are no remote 339 // Returns the latest remote ICE parameters or nullptr if there are no remote
337 // ICE parameters yet. 340 // ICE parameters yet.
338 IceParameters* remote_ice() { 341 IceParameters* remote_ice() {
339 return remote_ice_parameters_.empty() ? nullptr 342 return remote_ice_parameters_.empty() ? nullptr
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 uint32_t nomination_ = 0; 403 uint32_t nomination_ = 0;
401 404
402 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; 405 webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
403 406
404 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel); 407 RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
405 }; 408 };
406 409
407 } // namespace cricket 410 } // namespace cricket
408 411
409 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_ 412 #endif // WEBRTC_P2P_BASE_P2PTRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « webrtc/base/firewallsocketserver.cc ('k') | webrtc/p2p/base/p2ptransportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698