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

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 branch 'master' into enhanced_cg 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
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState 75 // TODO(deadbeef): Unify with PeerConnectionInterface::IceConnectionState
76 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming 76 // once /talk/ and /webrtc/ are combined, and also switch to ENUM_NAME naming
77 // style. 77 // style.
78 enum IceGatheringState { 78 enum IceGatheringState {
79 kIceGatheringNew = 0, 79 kIceGatheringNew = 0,
80 kIceGatheringGathering, 80 kIceGatheringGathering,
81 kIceGatheringComplete, 81 kIceGatheringComplete,
82 }; 82 };
83 83
84 enum ContinualGatheringPolicy {
85 // All port allocator sessions will stop after a writable connection is found.
86 GATHER_ONCE = 0,
87 // The most recent port allocator session will keep on running.
88 GATHER_CONTINUALLY,
89 // The most recent port allocator session will keep on running, and it will
90 // try to recover connectivity if the channel becomes disconnected.
91 GATHER_CONTINUALLY_AND_RECOVER,
92 };
93
84 // Stats that we can return about the connections for a transport channel. 94 // Stats that we can return about the connections for a transport channel.
85 // TODO(hta): Rename to ConnectionStats 95 // TODO(hta): Rename to ConnectionStats
86 struct ConnectionInfo { 96 struct ConnectionInfo {
87 ConnectionInfo() 97 ConnectionInfo()
88 : best_connection(false), 98 : best_connection(false),
89 writable(false), 99 writable(false),
90 receiving(false), 100 receiving(false),
91 timeout(false), 101 timeout(false),
92 new_connection(false), 102 new_connection(false),
93 rtt(0), 103 rtt(0),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 163
154 // Information about ICE configuration. 164 // Information about ICE configuration.
155 // TODO(deadbeef): Use rtc::Optional to represent unset values, instead of 165 // TODO(deadbeef): Use rtc::Optional to represent unset values, instead of
156 // -1. 166 // -1.
157 struct IceConfig { 167 struct IceConfig {
158 // The ICE connection receiving timeout value in milliseconds. 168 // The ICE connection receiving timeout value in milliseconds.
159 int receiving_timeout = -1; 169 int receiving_timeout = -1;
160 // Time interval in milliseconds to ping a backup connection when the ICE 170 // Time interval in milliseconds to ping a backup connection when the ICE
161 // channel is strongly connected. 171 // channel is strongly connected.
162 int backup_connection_ping_interval = -1; 172 int backup_connection_ping_interval = -1;
163 // If true, the most recent port allocator session will keep on running. 173
164 bool gather_continually = false; 174 ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
175
176 bool gather_continually() const {
177 return continual_gathering_policy == GATHER_CONTINUALLY ||
178 continual_gathering_policy == GATHER_CONTINUALLY_AND_RECOVER;
179 }
165 180
166 // Whether we should prioritize Relay/Relay candidate when nothing 181 // Whether we should prioritize Relay/Relay candidate when nothing
167 // is writable yet. 182 // is writable yet.
168 bool prioritize_most_likely_candidate_pairs = false; 183 bool prioritize_most_likely_candidate_pairs = false;
169 184
170 // Writable connections are pinged at a slower rate once stablized. 185 // Writable connections are pinged at a slower rate once stablized.
171 int stable_writable_connection_ping_interval = -1; 186 int stable_writable_connection_ping_interval = -1;
172 187
173 // If set to true, this means the ICE transport should presume TURN-to-TURN 188 // 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. 189 // candidate pairs will succeed, even before a binding response is received.
175 bool presume_writable_when_fully_relayed = false; 190 bool presume_writable_when_fully_relayed = false;
176 191
192 // Interval to check on all networks and to perform ICE regathering on any
193 // active network having no connection on it.
194 int regather_on_failed_networks_interval = -1;
195
177 IceConfig() {} 196 IceConfig() {}
178 IceConfig(int receiving_timeout_ms, 197 IceConfig(int receiving_timeout_ms,
179 int backup_connection_ping_interval, 198 int backup_connection_ping_interval,
180 bool gather_continually, 199 ContinualGatheringPolicy gathering_policy,
181 bool prioritize_most_likely_candidate_pairs, 200 bool prioritize_most_likely_candidate_pairs,
182 int stable_writable_connection_ping_interval_ms, 201 int stable_writable_connection_ping_interval_ms,
183 bool presume_writable_when_fully_relayed) 202 bool presume_writable_when_fully_relayed,
203 int regather_on_failed_networks_interval_ms)
184 : receiving_timeout(receiving_timeout_ms), 204 : receiving_timeout(receiving_timeout_ms),
185 backup_connection_ping_interval(backup_connection_ping_interval), 205 backup_connection_ping_interval(backup_connection_ping_interval),
186 gather_continually(gather_continually), 206 continual_gathering_policy(gathering_policy),
187 prioritize_most_likely_candidate_pairs( 207 prioritize_most_likely_candidate_pairs(
188 prioritize_most_likely_candidate_pairs), 208 prioritize_most_likely_candidate_pairs),
189 stable_writable_connection_ping_interval( 209 stable_writable_connection_ping_interval(
190 stable_writable_connection_ping_interval_ms), 210 stable_writable_connection_ping_interval_ms),
191 presume_writable_when_fully_relayed( 211 presume_writable_when_fully_relayed(
192 presume_writable_when_fully_relayed) {} 212 presume_writable_when_fully_relayed),
213 regather_on_failed_networks_interval(
214 regather_on_failed_networks_interval_ms) {}
193 }; 215 };
194 216
195 bool BadTransportDescription(const std::string& desc, std::string* err_desc); 217 bool BadTransportDescription(const std::string& desc, std::string* err_desc);
196 218
197 bool IceCredentialsChanged(const std::string& old_ufrag, 219 bool IceCredentialsChanged(const std::string& old_ufrag,
198 const std::string& old_pwd, 220 const std::string& old_pwd,
199 const std::string& new_ufrag, 221 const std::string& new_ufrag,
200 const std::string& new_pwd); 222 const std::string& new_pwd);
201 223
202 class Transport : public sigslot::has_slots<> { 224 class Transport : public sigslot::has_slots<> {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 398
377 ChannelMap channels_; 399 ChannelMap channels_;
378 400
379 RTC_DISALLOW_COPY_AND_ASSIGN(Transport); 401 RTC_DISALLOW_COPY_AND_ASSIGN(Transport);
380 }; 402 };
381 403
382 404
383 } // namespace cricket 405 } // namespace cricket
384 406
385 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_ 407 #endif // WEBRTC_P2P_BASE_TRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698