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

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

Issue 17132012: Proxy support for P2P TCP Socket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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"
11 #include "content/common/p2p_messages.h" 11 #include "content/common/p2p_messages.h"
12 #include "net/base/address_list.h" 12 #include "net/base/address_list.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/base/net_util.h" 14 #include "net/base/net_util.h"
15 #include "net/socket/stream_socket.h" 15 #include "net/socket/stream_socket.h"
16 #include "net/url_request/url_request_context.h"
17 #include "net/url_request/url_request_context_getter.h"
16 18
17 namespace { 19 namespace {
18 const int kListenBacklog = 5; 20 const int kListenBacklog = 5;
19 } // namespace 21 } // namespace
20 22
21 namespace content { 23 namespace content {
22 24
23 P2PSocketHostTcpServer::P2PSocketHostTcpServer( 25 P2PSocketHostTcpServer::P2PSocketHostTcpServer(
24 IPC::Sender* message_sender, int id, P2PSocketType client_type) 26 IPC::Sender* message_sender, int id, P2PSocketType client_type,
27 net::URLRequestContextGetter* context_getter)
Sergey Ulanov 2013/06/20 01:50:02 I think you don't really need context_getter here.
Mallinath (Gone from Chromium) 2013/06/20 05:24:15 Agree. Done.
25 : P2PSocketHost(message_sender, id), 28 : P2PSocketHost(message_sender, id),
26 client_type_(client_type), 29 client_type_(client_type),
30 context_getter_(context_getter),
27 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), 31 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())),
28 accept_callback_( 32 accept_callback_(
29 base::Bind(&P2PSocketHostTcpServer::OnAccepted, 33 base::Bind(&P2PSocketHostTcpServer::OnAccepted,
30 base::Unretained(this))) { 34 base::Unretained(this))) {
31 } 35 }
32 36
33 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { 37 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() {
34 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(), 38 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(),
35 accepted_sockets_.end()); 39 accepted_sockets_.end());
36 40
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const net::IPEndPoint& remote_address, int id) { 128 const net::IPEndPoint& remote_address, int id) {
125 AcceptedSocketsMap::iterator it = accepted_sockets_.find(remote_address); 129 AcceptedSocketsMap::iterator it = accepted_sockets_.find(remote_address);
126 if (it == accepted_sockets_.end()) 130 if (it == accepted_sockets_.end())
127 return NULL; 131 return NULL;
128 132
129 net::StreamSocket* socket = it->second; 133 net::StreamSocket* socket = it->second;
130 accepted_sockets_.erase(it); 134 accepted_sockets_.erase(it);
131 135
132 scoped_ptr<P2PSocketHostTcpBase> result; 136 scoped_ptr<P2PSocketHostTcpBase> result;
133 if (client_type_ == P2P_SOCKET_TCP_CLIENT) { 137 if (client_type_ == P2P_SOCKET_TCP_CLIENT) {
134 result.reset(new P2PSocketHostTcp(message_sender_, id)); 138 result.reset(new P2PSocketHostTcp(message_sender_, id, context_getter_));
135 } else { 139 } else {
136 result.reset(new P2PSocketHostStunTcp(message_sender_, id)); 140 result.reset(new P2PSocketHostStunTcp(
141 message_sender_, id, context_getter_));
137 } 142 }
138 if (!result->InitAccepted(remote_address, socket)) 143 if (!result->InitAccepted(remote_address, socket))
139 return NULL; 144 return NULL;
140 return result.release(); 145 return result.release();
141 } 146 }
142 147
143 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698