diff options
author | Guo-wei Shieh <guoweis@webrtc.org> | 2015-11-10 14:47:39 -0800 |
---|---|---|
committer | Guo-wei Shieh <guoweis@webrtc.org> | 2015-11-10 22:47:49 +0000 |
commit | 9af97f89103d8f1f77b52a6ae77b8b7bcdc23f71 (patch) | |
tree | b75c53b7ea88492c92933cc74db3927ba05aa5e7 /webrtc/p2p/base/stunport.h | |
parent | 542059ef10711eb398ef2c8dc6a99e9e328a56ea (diff) | |
download | webrtc-9af97f89103d8f1f77b52a6ae77b8b7bcdc23f71.tar.gz |
WebRTC should generate default private address even when adapter enumeration is disabled.
Introduce a DefaultAddressProvider such that rtc::Network can't access other part of NetworkManager.
This also removes the hack of generating the loopback address. The dependency has been removed by https://codereview.chromium.org/1417023003/
BUG=webrtc:5061
R=pthatcher@webrtc.org
Review URL: https://codereview.webrtc.org/1411253008 .
Cr-Commit-Position: refs/heads/master@{#10590}
Diffstat (limited to 'webrtc/p2p/base/stunport.h')
-rw-r--r-- | webrtc/p2p/base/stunport.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/webrtc/p2p/base/stunport.h b/webrtc/p2p/base/stunport.h index 62b23cf074..6e7a239578 100644 --- a/webrtc/p2p/base/stunport.h +++ b/webrtc/p2p/base/stunport.h @@ -35,10 +35,9 @@ class UDPPort : public Port { const std::string& username, const std::string& password, const std::string& origin, - bool emit_localhost_for_anyaddress) { - UDPPort* port = new UDPPort(thread, factory, network, socket, - username, password, origin, - emit_localhost_for_anyaddress); + bool emit_local_for_anyaddress) { + UDPPort* port = new UDPPort(thread, factory, network, socket, username, + password, origin, emit_local_for_anyaddress); if (!port->Init()) { delete port; port = NULL; @@ -55,11 +54,10 @@ class UDPPort : public Port { const std::string& username, const std::string& password, const std::string& origin, - bool emit_localhost_for_anyaddress) { - UDPPort* port = new UDPPort(thread, factory, network, - ip, min_port, max_port, - username, password, origin, - emit_localhost_for_anyaddress); + bool emit_local_for_anyaddress) { + UDPPort* port = + new UDPPort(thread, factory, network, ip, min_port, max_port, username, + password, origin, emit_local_for_anyaddress); if (!port->Init()) { delete port; port = NULL; @@ -115,7 +113,7 @@ class UDPPort : public Port { const std::string& username, const std::string& password, const std::string& origin, - bool emit_localhost_for_anyaddress); + bool emit_local_for_anyaddress); UDPPort(rtc::Thread* thread, rtc::PacketSocketFactory* factory, @@ -124,7 +122,7 @@ class UDPPort : public Port { const std::string& username, const std::string& password, const std::string& origin, - bool emit_localhost_for_anyaddress); + bool emit_local_for_anyaddress); bool Init(); @@ -150,6 +148,10 @@ class UDPPort : public Port { void SendStunBindingRequests(); + // Helper function which will set |addr|'s IP to the default local address if + // |addr| is the "any" address and |emit_local_for_anyaddress_| is true. + void MaybeSetDefaultLocalAddress(rtc::SocketAddress* addr) const; + private: // A helper class which can be called repeatedly to resolve multiple // addresses, as opposed to rtc::AsyncResolverInterface, which can only @@ -211,8 +213,9 @@ class UDPPort : public Port { bool ready_; int stun_keepalive_delay_; - // This is true when PORTALLOCATOR_ENABLE_LOCALHOST_CANDIDATE is specified. - bool emit_localhost_for_anyaddress_; + // This is true by default and false when + // PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE is specified. + bool emit_local_for_anyaddress_; friend class StunBindingRequest; }; |