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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp.cc

Issue 2140693002: Support port range for IPC P2P UDP sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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/browser/renderer_host/p2p/socket_host_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 remote_address_.ip_address = remote_address; 75 remote_address_.ip_address = remote_address;
76 // TODO(ronghuawu): Add FakeSSLServerSocket. 76 // TODO(ronghuawu): Add FakeSSLServerSocket.
77 socket_.reset(socket); 77 socket_.reset(socket);
78 state_ = STATE_OPEN; 78 state_ = STATE_OPEN;
79 DoRead(); 79 DoRead();
80 return state_ != STATE_ERROR; 80 return state_ != STATE_ERROR;
81 } 81 }
82 82
83 bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address, 83 bool P2PSocketHostTcpBase::Init(const net::IPEndPoint& local_address,
84 uint16_t min_port,
85 uint16_t max_port,
84 const P2PHostAndIPEndPoint& remote_address) { 86 const P2PHostAndIPEndPoint& remote_address) {
85 DCHECK_EQ(state_, STATE_UNINITIALIZED); 87 DCHECK_EQ(state_, STATE_UNINITIALIZED);
86 88
87 remote_address_ = remote_address; 89 remote_address_ = remote_address;
88 state_ = STATE_CONNECTING; 90 state_ = STATE_CONNECTING;
89 91
90 net::HostPortPair dest_host_port_pair; 92 net::HostPortPair dest_host_port_pair;
91 // If there is a domain name, let's try it first, it's required by some proxy 93 // If there is a domain name, let's try it first, it's required by some proxy
92 // to only take hostname for CONNECT. If it has been DNS resolved, the result 94 // to only take hostname for CONNECT. If it has been DNS resolved, the result
93 // is likely cached and shouldn't cause 2nd DNS resolution in the case of 95 // is likely cached and shouldn't cause 2nd DNS resolution in the case of
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } else { 640 } else {
639 packet_size += kTurnChannelDataHeaderSize; 641 packet_size += kTurnChannelDataHeaderSize;
640 // Calculate any padding if present. 642 // Calculate any padding if present.
641 if (packet_size % 4) 643 if (packet_size % 4)
642 *pad_bytes = 4 - packet_size % 4; 644 *pad_bytes = 4 - packet_size % 4;
643 } 645 }
644 return packet_size; 646 return packet_size;
645 } 647 }
646 648
647 } // namespace content 649 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698