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

Unified Diff: content/renderer/p2p/port_allocator.cc

Issue 7888022: Add DISABLE_TCP_TRANSPORT flag in the Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 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 | « no previous file | ppapi/c/dev/ppb_transport_dev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_transport_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698