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

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

Issue 2025573002: Use continual gathering to restore backup connections (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Merge Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/portinterface.h ('k') | webrtc/p2p/base/transportcontroller_unittest.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 13 matching lines...) Expand all
24 24
25 #ifndef WEBRTC_P2P_BASE_TRANSPORT_H_ 25 #ifndef WEBRTC_P2P_BASE_TRANSPORT_H_
26 #define WEBRTC_P2P_BASE_TRANSPORT_H_ 26 #define WEBRTC_P2P_BASE_TRANSPORT_H_
27 27
28 #include <map> 28 #include <map>
29 #include <memory> 29 #include <memory>
30 #include <string> 30 #include <string>
31 #include <vector> 31 #include <vector>
32 32
33 #include "webrtc/base/constructormagic.h" 33 #include "webrtc/base/constructormagic.h"
34 #include "webrtc/base/optional.h"
34 #include "webrtc/p2p/base/candidate.h" 35 #include "webrtc/p2p/base/candidate.h"
35 #include "webrtc/p2p/base/p2pconstants.h" 36 #include "webrtc/p2p/base/p2pconstants.h"
36 #include "webrtc/p2p/base/sessiondescription.h" 37 #include "webrtc/p2p/base/sessiondescription.h"
37 #include "webrtc/p2p/base/transportinfo.h" 38 #include "webrtc/p2p/base/transportinfo.h"
38 #include "webrtc/base/messagequeue.h" 39 #include "webrtc/base/messagequeue.h"
39 #include "webrtc/base/rtccertificate.h" 40 #include "webrtc/base/rtccertificate.h"
40 #include "webrtc/base/sigslot.h" 41 #include "webrtc/base/sigslot.h"
41 #include "webrtc/base/sslstreamadapter.h" 42 #include "webrtc/base/sslstreamadapter.h"
42 43
43 namespace cricket { 44 namespace cricket {
(...skipping 30 matching lines...) Expand all
74 75
75 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState 76 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState
76 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming 77 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming
77 // style. 78 // style.
78 enum IceGatheringState { 79 enum IceGatheringState {
79 kIceGatheringNew = 0, 80 kIceGatheringNew = 0,
80 kIceGatheringGathering, 81 kIceGatheringGathering,
81 kIceGatheringComplete, 82 kIceGatheringComplete,
82 }; 83 };
83 84
85 enum ContinualGatheringPolicy {
86 // All port allocator sessions will stop after a writable connection is found.
87 GATHER_ONCE = 0,
88 // The most recent port allocator session will keep on running.
89 GATHER_CONTINUALLY,
90 // The most recent port allocator session will keep on running, and it will
91 // try to recover connectivity if the channel becomes disconnected.
92 GATHER_CONTINUALLY_AND_RECOVER,
93 };
94
84 // Stats that we can return about the connections for a transport channel. 95 // Stats that we can return about the connections for a transport channel.
85 // TODO(hta): Rename to ConnectionStats 96 // TODO(hta): Rename to ConnectionStats
86 struct ConnectionInfo { 97 struct ConnectionInfo {
87 ConnectionInfo() 98 ConnectionInfo()
88 : best_connection(false), 99 : best_connection(false),
89 writable(false), 100 writable(false),
90 receiving(false), 101 receiving(false),
91 timeout(false), 102 timeout(false),
92 new_connection(false), 103 new_connection(false),
93 rtt(0), 104 rtt(0),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 164
154 // Information about ICE configuration. 165 // Information about ICE configuration.
155 // TODO(deadbeef): Use rtc::Optional to represent unset values, instead of 166 // TODO(deadbeef): Use rtc::Optional to represent unset values, instead of
156 // -1. 167 // -1.
157 struct IceConfig { 168 struct IceConfig {
158 // The ICE connection receiving timeout value in milliseconds. 169 // The ICE connection receiving timeout value in milliseconds.
159 int receiving_timeout = -1; 170 int receiving_timeout = -1;
160 // Time interval in milliseconds to ping a backup connection when the ICE 171 // Time interval in milliseconds to ping a backup connection when the ICE
161 // channel is strongly connected. 172 // channel is strongly connected.
162 int backup_connection_ping_interval = -1; 173 int backup_connection_ping_interval = -1;
163 // If true, the most recent port allocator session will keep on running. 174
164 bool gather_continually = false; 175 ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
176
177 bool gather_continually() const {
178 return continual_gathering_policy == GATHER_CONTINUALLY ||
179 continual_gathering_policy == GATHER_CONTINUALLY_AND_RECOVER;
180 }
165 181
166 // Whether we should prioritize Relay/Relay candidate when nothing 182 // Whether we should prioritize Relay/Relay candidate when nothing
167 // is writable yet. 183 // is writable yet.
168 bool prioritize_most_likely_candidate_pairs = false; 184 bool prioritize_most_likely_candidate_pairs = false;
169 185
170 // Writable connections are pinged at a slower rate once stablized. 186 // Writable connections are pinged at a slower rate once stablized.
171 int stable_writable_connection_ping_interval = -1; 187 int stable_writable_connection_ping_interval = -1;
172 188
173 // If set to true, this means the ICE transport should presume TURN-to-TURN 189 // If set to true, this means the ICE transport should presume TURN-to-TURN
174 // candidate pairs will succeed, even before a binding response is received. 190 // candidate pairs will succeed, even before a binding response is received.
175 bool presume_writable_when_fully_relayed = false; 191 bool presume_writable_when_fully_relayed = false;
176 192
193 // Interval to check on all networks and to perform ICE regathering on any
194 // active network having no connection on it.
195 rtc::Optional<int> regather_on_failed_networks_interval;
196
177 IceConfig() {} 197 IceConfig() {}
178 IceConfig(int receiving_timeout_ms, 198 IceConfig(int receiving_timeout_ms,
179 int backup_connection_ping_interval, 199 int backup_connection_ping_interval,
180 bool gather_continually, 200 ContinualGatheringPolicy gathering_policy,
181 bool prioritize_most_likely_candidate_pairs, 201 bool prioritize_most_likely_candidate_pairs,
182 int stable_writable_connection_ping_interval_ms, 202 int stable_writable_connection_ping_interval_ms,
183 bool presume_writable_when_fully_relayed) 203 bool presume_writable_when_fully_relayed,
204 int regather_on_failed_networks_interval_ms)
184 : receiving_timeout(receiving_timeout_ms), 205 : receiving_timeout(receiving_timeout_ms),
185 backup_connection_ping_interval(backup_connection_ping_interval), 206 backup_connection_ping_interval(backup_connection_ping_interval),
186 gather_continually(gather_continually), 207 continual_gathering_policy(gathering_policy),
187 prioritize_most_likely_candidate_pairs( 208 prioritize_most_likely_candidate_pairs(
188 prioritize_most_likely_candidate_pairs), 209 prioritize_most_likely_candidate_pairs),
189 stable_writable_connection_ping_interval( 210 stable_writable_connection_ping_interval(
190 stable_writable_connection_ping_interval_ms), 211 stable_writable_connection_ping_interval_ms),
191 presume_writable_when_fully_relayed( 212 presume_writable_when_fully_relayed(
192 presume_writable_when_fully_relayed) {} 213 presume_writable_when_fully_relayed),
214 regather_on_failed_networks_interval(
215 regather_on_failed_networks_interval_ms) {}
193 }; 216 };
194 217
195 bool BadTransportDescription(const std::string& desc, std::string* err_desc); 218 bool BadTransportDescription(const std::string& desc, std::string* err_desc);
196 219
197 bool IceCredentialsChanged(const std::string& old_ufrag, 220 bool IceCredentialsChanged(const std::string& old_ufrag,
198 const std::string& old_pwd, 221 const std::string& old_pwd,
199 const std::string& new_ufrag, 222 const std::string& new_ufrag,
200 const std::string& new_pwd); 223 const std::string& new_pwd);
201 224
202 class Transport : public sigslot::has_slots<> { 225 class Transport : public sigslot::has_slots<> {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 392
370 ChannelMap channels_; 393 ChannelMap channels_;
371 394
372 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); 395 RTC_DISALLOW_COPY_AND_ASSIGN(Transport);
373 }; 396 };
374 397
375 398
376 } // namespace cricket 399 } // namespace cricket
377 400
378 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ 401 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/portinterface.h ('k') | webrtc/p2p/base/transportcontroller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698