Chromium Code Reviews| Index: content/renderer/p2p/port_allocator.cc |
| diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc |
| index 42df2750be6946993dca5d549c526b6ca0de9c24..9411996e65ade74dbebda62a11caaae1251d3f2c 100644 |
| --- a/content/renderer/p2p/port_allocator.cc |
| +++ b/content/renderer/p2p/port_allocator.cc |
| @@ -11,6 +11,7 @@ |
| #include "content/renderer/p2p/host_address_request.h" |
| #include "jingle/glue/utils.h" |
| #include "net/base/ip_endpoint.h" |
| +#include "ppapi/c/dev/ppb_transport_dev.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoader.h" |
| @@ -59,6 +60,19 @@ P2PPortAllocator::P2PPortAllocator( |
| web_frame_(web_frame), |
| socket_dispatcher_(socket_dispatcher), |
| config_(config) { |
| + uint32 flags = 0; |
| + if (config_.protocols & PP_TRANSPORTPROTOCOL_UDP) |
| + flags |= cricket::PORTALLOCATOR_DISABLE_UDP; |
| + if (config_.protocols & PP_TRANSPORTPROTOCOL_TCP) |
| + flags |= cricket::PORTALLOCATOR_DISABLE_TCP; |
| + if (config_.protocols & PP_TRANSPORTPROTOCOL_STUN) |
| + flags |= cricket::PORTALLOCATOR_DISABLE_STUN; |
| + if ((config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_UDP) && |
| + (config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_TCP) && |
| + (config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_SSLTCP)) { |
| + flags |= cricket::PORTALLOCATOR_DISABLE_RELAY; |
| + } |
| + set_flags(flags); |
| } |
| P2PPortAllocator::~P2PPortAllocator() { |
| @@ -126,6 +140,9 @@ void P2PPortAllocatorSession::ResolveStunServerAddress() { |
| if (allocator_->config_.stun_server.empty()) |
| return; |
| + if (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_STUN) |
| + return; |
| + |
| DCHECK(!stun_address_request_); |
| stun_address_request_ = |
| new P2PHostAddressRequest(allocator_->socket_dispatcher_); |
| @@ -155,6 +172,12 @@ void P2PPortAllocatorSession::AllocateRelaySession() { |
| if (allocator_->config_.relay_server.empty()) |
| return; |
| + if ((allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_UDP) && |
| + (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_TCP) && |
| + (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_SSLTCP)) { |
| + return; |
| + } |
| + |
| if (!allocator_->config_.legacy_relay) { |
| NOTIMPLEMENTED() << " TURN support is not implemented yet."; |
| return; |
| @@ -253,15 +276,18 @@ void P2PPortAllocatorSession::AddConfig() { |
| cricket::PortConfiguration::PortList ports; |
| if (relay_ip_.ip() != 0) { |
| - if (relay_udp_port_ > 0) { |
| + if (relay_udp_port_ > 0 && |
| + (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_UDP)) { |
|
juberti
2011/09/13 21:14:19
Why do we care what protocol the remote side uses
Sergey Ulanov
2011/09/13 21:55:49
For chromoting we disable TCP ports because they p
|
| talk_base::SocketAddress address(relay_ip_.ip(), relay_udp_port_); |
| ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_UDP)); |
| } |
| - if (relay_tcp_port_ > 0) { |
| + if (relay_tcp_port_ > 0 && |
| + (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_TCP)) { |
| talk_base::SocketAddress address(relay_ip_.ip(), relay_tcp_port_); |
| ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_TCP)); |
| } |
| - if (relay_ssltcp_port_ > 0) { |
| + if (relay_ssltcp_port_ > 0 && |
| + (allocator_->config_.protocols & PP_TRANSPORTPROTOCOL_RELAY_SSLTCP)) { |
| talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_); |
| ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP)); |
| } |