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

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

Issue 1737493004: Keep on sending stun binding requests on zero-cost networks. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added tests, chaneged to 64bit lifetime. Created 4 years, 9 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return protocol == UDP_PROTOCOL_NAME; 99 return protocol == UDP_PROTOCOL_NAME;
100 } 100 }
101 101
102 void set_stun_keepalive_delay(int delay) { 102 void set_stun_keepalive_delay(int delay) {
103 stun_keepalive_delay_ = delay; 103 stun_keepalive_delay_ = delay;
104 } 104 }
105 int stun_keepalive_delay() const { 105 int stun_keepalive_delay() const {
106 return stun_keepalive_delay_; 106 return stun_keepalive_delay_;
107 } 107 }
108 108
109 // Visible for testing.
110 int stun_keepalive_lifetime() const { return stun_keepalive_lifetime_; }
111 void set_stun_keepalive_lifetime(int lifetime) {
112 stun_keepalive_lifetime_ = lifetime;
113 }
114 // Returns true if there is a pending request with type |msg_type|.
115 bool RequestExists(int msg_type) { return requests_.Exist(msg_type); }
pthatcher1 2016/03/02 20:25:59 A better name might be HasPendingRequest
honghaiz3 2016/03/02 23:22:51 Done.
116
109 protected: 117 protected:
110 UDPPort(rtc::Thread* thread, 118 UDPPort(rtc::Thread* thread,
111 rtc::PacketSocketFactory* factory, 119 rtc::PacketSocketFactory* factory,
112 rtc::Network* network, 120 rtc::Network* network,
113 const rtc::IPAddress& ip, 121 const rtc::IPAddress& ip,
114 uint16_t min_port, 122 uint16_t min_port,
115 uint16_t max_port, 123 uint16_t max_port,
116 const std::string& username, 124 const std::string& username,
117 const std::string& password, 125 const std::string& password,
118 const std::string& origin, 126 const std::string& origin,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 218
211 ServerAddresses server_addresses_; 219 ServerAddresses server_addresses_;
212 ServerAddresses bind_request_succeeded_servers_; 220 ServerAddresses bind_request_succeeded_servers_;
213 ServerAddresses bind_request_failed_servers_; 221 ServerAddresses bind_request_failed_servers_;
214 StunRequestManager requests_; 222 StunRequestManager requests_;
215 rtc::AsyncPacketSocket* socket_; 223 rtc::AsyncPacketSocket* socket_;
216 int error_; 224 int error_;
217 rtc::scoped_ptr<AddressResolver> resolver_; 225 rtc::scoped_ptr<AddressResolver> resolver_;
218 bool ready_; 226 bool ready_;
219 int stun_keepalive_delay_; 227 int stun_keepalive_delay_;
228 int stun_keepalive_lifetime_;
220 229
221 // This is true by default and false when 230 // This is true by default and false when
222 // PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE is specified. 231 // PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE is specified.
223 bool emit_local_for_anyaddress_; 232 bool emit_local_for_anyaddress_;
224 233
225 friend class StunBindingRequest; 234 friend class StunBindingRequest;
226 }; 235 };
227 236
228 class StunPort : public UDPPort { 237 class StunPort : public UDPPort {
229 public: 238 public:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 false) { 286 false) {
278 // UDPPort will set these to local udp, updating these to STUN. 287 // UDPPort will set these to local udp, updating these to STUN.
279 set_type(STUN_PORT_TYPE); 288 set_type(STUN_PORT_TYPE);
280 set_server_addresses(servers); 289 set_server_addresses(servers);
281 } 290 }
282 }; 291 };
283 292
284 } // namespace cricket 293 } // namespace cricket
285 294
286 #endif // WEBRTC_P2P_BASE_STUNPORT_H_ 295 #endif // WEBRTC_P2P_BASE_STUNPORT_H_
OLDNEW
« no previous file with comments | « webrtc/base/network.h ('k') | webrtc/p2p/base/stunport.cc » ('j') | webrtc/p2p/base/stunport.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698