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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp_server.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_server.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" 10 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
(...skipping 21 matching lines...) Expand all
32 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { 32 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() {
33 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(), 33 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(),
34 accepted_sockets_.end()); 34 accepted_sockets_.end());
35 35
36 if (state_ == STATE_OPEN) { 36 if (state_ == STATE_OPEN) {
37 DCHECK(socket_.get()); 37 DCHECK(socket_.get());
38 socket_.reset(); 38 socket_.reset();
39 } 39 }
40 } 40 }
41 41
42 // TODO(guidou): Add support for port range.
Guido Urdaneta 2016/07/11 17:14:54 I can add this support in a follow-up CL or in ano
42 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address, 43 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address,
44 uint16_t min_port,
45 uint16_t max_port,
43 const P2PHostAndIPEndPoint& remote_address) { 46 const P2PHostAndIPEndPoint& remote_address) {
44 DCHECK_EQ(state_, STATE_UNINITIALIZED); 47 DCHECK_EQ(state_, STATE_UNINITIALIZED);
45 48
46 int result = socket_->Listen(local_address, kListenBacklog); 49 int result = socket_->Listen(local_address, kListenBacklog);
47 if (result < 0) { 50 if (result < 0) {
48 LOG(ERROR) << "Listen() failed: " << result; 51 LOG(ERROR) << "Listen() failed: " << result;
49 OnError(); 52 OnError();
50 return false; 53 return false;
51 } 54 }
52 55
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return result.release(); 148 return result.release();
146 } 149 }
147 150
148 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, 151 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option,
149 int value) { 152 int value) {
150 // Currently we don't have use case tcp server sockets are used for p2p. 153 // Currently we don't have use case tcp server sockets are used for p2p.
151 return false; 154 return false;
152 } 155 }
153 156
154 } // namespace content 157 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698