OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
9 #include "content/common/p2p_messages.h" | 9 #include "content/common/p2p_messages.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
13 #include "net/base/sys_addrinfo.h" | 13 #include "net/base/sys_addrinfo.h" |
14 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
15 | 15 |
16 namespace content { | |
17 | |
16 namespace { | 18 namespace { |
jam
2011/08/24 00:24:27
ditto
Sergey Ulanov
2011/08/24 01:57:48
Done.
| |
17 const int kListenBacklog = 5; | 19 const int kListenBacklog = 5; |
18 } // namespace | 20 } // namespace |
19 | 21 |
20 P2PSocketHostTcpServer::P2PSocketHostTcpServer( | 22 P2PSocketHostTcpServer::P2PSocketHostTcpServer( |
21 IPC::Message::Sender* message_sender, | 23 IPC::Message::Sender* message_sender, |
22 int routing_id, int id) | 24 int routing_id, int id) |
23 : P2PSocketHost(message_sender, routing_id, id), | 25 : P2PSocketHost(message_sender, routing_id, id), |
24 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), | 26 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), |
25 ALLOW_THIS_IN_INITIALIZER_LIST( | 27 ALLOW_THIS_IN_INITIALIZER_LIST( |
26 accept_callback_(this, &P2PSocketHostTcpServer::OnAccepted)) { | 28 accept_callback_(this, &P2PSocketHostTcpServer::OnAccepted)) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 | 130 |
129 net::StreamSocket* socket = it->second; | 131 net::StreamSocket* socket = it->second; |
130 accepted_sockets_.erase(it); | 132 accepted_sockets_.erase(it); |
131 scoped_ptr<P2PSocketHostTcp> result( | 133 scoped_ptr<P2PSocketHostTcp> result( |
132 new P2PSocketHostTcp(message_sender_, routing_id_, id)); | 134 new P2PSocketHostTcp(message_sender_, routing_id_, id)); |
133 if (!result->InitAccepted(remote_address, socket)) | 135 if (!result->InitAccepted(remote_address, socket)) |
134 return NULL; | 136 return NULL; |
135 | 137 |
136 return result.release(); | 138 return result.release(); |
137 } | 139 } |
140 | |
141 } // namespace content | |
OLD | NEW |