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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const std::string& string, int* value) { | 43 const std::string& string, int* value) { |
44 if (!base::StringToInt(string, value) || *value <= 0 || *value >= 65536) { | 44 if (!base::StringToInt(string, value) || *value <= 0 || *value >= 65536) { |
45 LOG(ERROR) << "Received invalid port number from relay server: " << string; | 45 LOG(ERROR) << "Received invalid port number from relay server: " << string; |
46 return false; | 46 return false; |
47 } | 47 } |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
| 53 P2PPortAllocator::Config::Config() { |
| 54 } |
| 55 |
| 56 P2PPortAllocator::Config::~Config() { |
| 57 } |
| 58 |
53 P2PPortAllocator::P2PPortAllocator( | 59 P2PPortAllocator::P2PPortAllocator( |
54 WebKit::WebFrame* web_frame, | 60 WebKit::WebFrame* web_frame, |
55 P2PSocketDispatcher* socket_dispatcher, | 61 P2PSocketDispatcher* socket_dispatcher, |
56 talk_base::NetworkManager* network_manager, | 62 talk_base::NetworkManager* network_manager, |
57 talk_base::PacketSocketFactory* socket_factory, | 63 talk_base::PacketSocketFactory* socket_factory, |
58 const webkit_glue::P2PTransport::Config& config) | 64 const Config& config) |
59 : cricket::BasicPortAllocator(network_manager, socket_factory), | 65 : cricket::BasicPortAllocator(network_manager, socket_factory), |
60 web_frame_(web_frame), | 66 web_frame_(web_frame), |
61 socket_dispatcher_(socket_dispatcher), | 67 socket_dispatcher_(socket_dispatcher), |
62 config_(config) { | 68 config_(config) { |
63 uint32 flags = 0; | 69 uint32 flags = 0; |
64 if (config_.disable_tcp_transport) | 70 if (config_.disable_tcp_transport) |
65 flags |= cricket::PORTALLOCATOR_DISABLE_TCP; | 71 flags |= cricket::PORTALLOCATOR_DISABLE_TCP; |
66 set_flags(flags); | 72 set_flags(flags); |
67 } | 73 } |
68 | 74 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_); | 302 talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_); |
297 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP)); | 303 ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP)); |
298 } | 304 } |
299 if (!ports.empty()) | 305 if (!ports.empty()) |
300 config->AddRelay(ports, 0.0f); | 306 config->AddRelay(ports, 0.0f); |
301 } | 307 } |
302 ConfigReady(config); | 308 ConfigReady(config); |
303 } | 309 } |
304 | 310 |
305 } // namespace content | 311 } // namespace content |
OLD | NEW |