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

Unified Diff: content/browser/renderer_host/p2p/socket_dispatcher_host.cc

Issue 2140693002: Support port range for IPC P2P UDP sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove unused constructor from test Created 4 years, 5 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
Index: content/browser/renderer_host/p2p/socket_dispatcher_host.cc
diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
index 8cbb0d60b91ff8b9c1d5e9a5f4038c8767666442..6419eafb7c020cecca4cab84cba78ee25dfa5466 100644
--- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
+++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/stl_util.h"
+#include "content/browser/bad_message.h"
#include "content/browser/renderer_host/p2p/socket_host.h"
#include "content/common/p2p_messages.h"
#include "content/public/browser/browser_thread.h"
@@ -237,9 +238,17 @@ void P2PSocketDispatcherHost::OnGetHostAddress(const std::string& host_name,
}
void P2PSocketDispatcherHost::OnCreateSocket(
- P2PSocketType type, int socket_id,
+ P2PSocketType type,
+ int socket_id,
const net::IPEndPoint& local_address,
+ const P2PPortRange& port_range,
const P2PHostAndIPEndPoint& remote_address) {
+ if (port_range.min_port < port_range.max_port ||
+ (port_range.min_port == 0 && port_range.max_port != 0)) {
+ bad_message::ReceivedBadMessage(this, bad_message::SDH_INVALID_PORT_RANGE);
+ return;
+ }
+
if (LookupSocket(socket_id)) {
LOG(ERROR) << "Received P2PHostMsg_CreateSocket for socket "
"that already exists.";
@@ -254,7 +263,8 @@ void P2PSocketDispatcherHost::OnCreateSocket(
return;
}
- if (socket->Init(local_address, remote_address)) {
+ if (socket->Init(local_address, port_range.min_port, port_range.max_port,
+ remote_address)) {
sockets_[socket_id] = socket.release();
if (dump_incoming_rtp_packet_ || dump_outgoing_rtp_packet_) {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_dispatcher_host.h ('k') | content/browser/renderer_host/p2p/socket_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698