OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/p2p/port_allocator.h" | 5 #include "content/renderer/p2p/port_allocator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 LOG(ERROR) << "Relay session request failed."; | 135 LOG(ERROR) << "Relay session request failed."; |
136 | 136 |
137 // Retry the request. | 137 // Retry the request. |
138 AllocateRelaySession(); | 138 AllocateRelaySession(); |
139 } | 139 } |
140 | 140 |
141 void P2PPortAllocatorSession::GetPortConfigurations() { | 141 void P2PPortAllocatorSession::GetPortConfigurations() { |
142 // Add an empty configuration synchronously, so a local connection | 142 // Add an empty configuration synchronously, so a local connection |
143 // can be started immediately. | 143 // can be started immediately. |
144 ConfigReady(new cricket::PortConfiguration(talk_base::SocketAddress())); | 144 ConfigReady(new cricket::PortConfiguration(talk_base::SocketAddress(), |
| 145 "", "")); |
145 | 146 |
146 if (stun_server_address_.IsNil()) { | 147 if (stun_server_address_.IsNil()) { |
147 ResolveStunServerAddress(); | 148 ResolveStunServerAddress(); |
148 } else { | 149 } else { |
149 AddConfig(); | 150 AddConfig(); |
150 } | 151 } |
151 | 152 |
152 AllocateRelaySession(); | 153 AllocateRelaySession(); |
153 } | 154 } |
154 | 155 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (!ParsePortNumber(value, &relay_ssltcp_port_)) | 284 if (!ParsePortNumber(value, &relay_ssltcp_port_)) |
284 return; | 285 return; |
285 } | 286 } |
286 } | 287 } |
287 | 288 |
288 AddConfig(); | 289 AddConfig(); |
289 } | 290 } |
290 | 291 |
291 void P2PPortAllocatorSession::AddConfig() { | 292 void P2PPortAllocatorSession::AddConfig() { |
292 cricket::PortConfiguration* config = | 293 cricket::PortConfiguration* config = |
293 new cricket::PortConfiguration(stun_server_address_); | 294 new cricket::PortConfiguration(stun_server_address_, "", ""); |
294 | 295 |
295 if (relay_ip_.ip() != 0) { | 296 if (relay_ip_.ip() != 0) { |
296 cricket::PortConfiguration::PortList ports; | 297 cricket::PortConfiguration::PortList ports; |
297 if (relay_udp_port_ > 0) { | 298 if (relay_udp_port_ > 0) { |
298 talk_base::SocketAddress address(relay_ip_.ip(), relay_udp_port_); | 299 talk_base::SocketAddress address(relay_ip_.ip(), relay_udp_port_); |
299 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_UDP)); | 300 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_UDP)); |
300 } | 301 } |
301 if (relay_tcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) { | 302 if (relay_tcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) { |
302 talk_base::SocketAddress address(relay_ip_.ip(), relay_tcp_port_); | 303 talk_base::SocketAddress address(relay_ip_.ip(), relay_tcp_port_); |
303 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_TCP)); | 304 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_TCP)); |
304 } | 305 } |
305 if (relay_ssltcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) { | 306 if (relay_ssltcp_port_ > 0 && !allocator_->config_.disable_tcp_transport) { |
306 talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_); | 307 talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_); |
307 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP)); | 308 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP)); |
308 } | 309 } |
309 if (!ports.empty()) | 310 if (!ports.empty()) |
310 config->AddRelay(ports, 0.0f); | 311 config->AddRelay(ports, 0.0f); |
311 } | 312 } |
312 ConfigReady(config); | 313 ConfigReady(config); |
313 } | 314 } |
314 | 315 |
315 } // namespace content | 316 } // namespace content |
OLD | NEW |