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

Unified Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1215713003: Ensuring that UDP TURN servers are always used as STUN servers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing compiler warning from size_t->int cast Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.cc
diff --git a/webrtc/p2p/client/basicportallocator.cc b/webrtc/p2p/client/basicportallocator.cc
index 41edd85e9eb9ff5e901ad0baa75188da4888d6af..30d9fe47aa215a8ff67c086c89e4f2f64f882f57 100644
--- a/webrtc/p2p/client/basicportallocator.cc
+++ b/webrtc/p2p/client/basicportallocator.cc
@@ -206,7 +206,7 @@ void BasicPortAllocator::Construct() {
BasicPortAllocator::~BasicPortAllocator() {
}
-PortAllocatorSession *BasicPortAllocator::CreateSessionInternal(
+PortAllocatorSession* BasicPortAllocator::CreateSessionInternal(
const std::string& content_name, int component,
const std::string& ice_ufrag, const std::string& ice_pwd) {
return new BasicPortAllocatorSession(
@@ -925,18 +925,10 @@ void AllocationSequence::CreateUDPPorts() {
// If STUN is not disabled, setting stun server address to port.
if (!IsFlagSet(PORTALLOCATOR_DISABLE_STUN)) {
- // If config has stun_servers, use it to get server reflexive candidate
- // otherwise use first TURN server which supports UDP.
if (config_ && !config_->StunServers().empty()) {
LOG(LS_INFO) << "AllocationSequence: UDPPort will be handling the "
<< "STUN candidate generation.";
port->set_server_addresses(config_->StunServers());
- } else if (config_ &&
- config_->SupportsProtocol(RELAY_TURN, PROTO_UDP)) {
- port->set_server_addresses(config_->GetRelayServerAddresses(
- RELAY_TURN, PROTO_UDP));
- LOG(LS_INFO) << "AllocationSequence: TURN Server address will be "
- << " used for generating STUN candidate.";
}
}
}
@@ -1169,6 +1161,13 @@ ServerAddresses PortConfiguration::StunServers() {
stun_servers.find(stun_address) == stun_servers.end()) {
stun_servers.insert(stun_address);
}
+ // Every UDP TURN server should also be used as a STUN server.
+ ServerAddresses turn_servers = GetRelayServerAddresses(RELAY_TURN, PROTO_UDP);
+ for (const rtc::SocketAddress& turn_server : turn_servers) {
+ if (stun_servers.find(turn_server) == stun_servers.end()) {
+ stun_servers.insert(turn_server);
+ }
+ }
return stun_servers;
}
« no previous file with comments | « webrtc/p2p/client/basicportallocator.h ('k') | webrtc/p2p/client/portallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698