| Index: content/renderer/p2p/port_allocator.cc
|
| diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc
|
| index 28f72b7be12d697fadfe087eca41b0c482f4d074..b2267e1088828d73b087fb61a5deb43910f50a99 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.cc"
|
| #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_.port_types & PP_TRANSPORTPORTS_UDP)
|
| + flags |= cricket::PORTALLOCATOR_DISABLE_UDP;
|
| + if (config_.port_types & PP_TRANSPORTPORTS_TCP)
|
| + flags |= cricket::PORTALLOCATOR_DISABLE_TCP;
|
| + if (config_.port_types & PP_TRANSPORTPORTS_STUN)
|
| + flags |= cricket::PORTALLOCATOR_DISABLE_STUN;
|
| + if ((config_.port_types & PP_TRANSPORTPORTS_RELAY_UDP) &&
|
| + (config_.port_types & PP_TRANSPORTPORTS_RELAY_TCP) &&
|
| + (config_.port_types & PP_TRANSPORTPORTS_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_.port_types & PP_TRANSPORTPORTS_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_.port_types & PP_TRANSPORTPORTS_RELAY_UDP) &&
|
| + (allocator_->config_.port_types & PP_TRANSPORTPORTS_RELAY_TCP) &&
|
| + (allocator_->config_.port_types & PP_TRANSPORTPORTS_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_.port_types & PP_TRANSPORTPORTS_RELAY_UDP)) {
|
| 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_.port_types & PP_TRANSPORTPORTS_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_.port_types & PP_TRANSPORTPORTS_RELAY_SSLTCP)) {
|
| talk_base::SocketAddress address(relay_ip_.ip(), relay_ssltcp_port_);
|
| ports.push_back(cricket::ProtocolAddress(address, cricket::PROTO_SSLTCP));
|
| }
|
|
|