OLD | NEW |
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 "content/browser/renderer_host/p2p/socket_host_tcp.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
10 #include "content/common/p2p_messages.h" | 10 #include "content/common/p2p_messages.h" |
11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/log/net_log_source.h" |
13 #include "net/socket/stream_socket.h" | 14 #include "net/socket/stream_socket.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 const int kListenBacklog = 5; | 17 const int kListenBacklog = 5; |
17 } // namespace | 18 } // namespace |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 | 21 |
21 P2PSocketHostTcpServer::P2PSocketHostTcpServer(IPC::Sender* message_sender, | 22 P2PSocketHostTcpServer::P2PSocketHostTcpServer(IPC::Sender* message_sender, |
22 int socket_id, | 23 int socket_id, |
23 P2PSocketType client_type) | 24 P2PSocketType client_type) |
24 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::TCP), | 25 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::TCP), |
25 client_type_(client_type), | 26 client_type_(client_type), |
26 socket_(new net::TCPServerSocket(nullptr, net::NetLog::Source())), | 27 socket_(new net::TCPServerSocket(nullptr, net::NetLogSource())), |
27 accept_callback_(base::Bind(&P2PSocketHostTcpServer::OnAccepted, | 28 accept_callback_(base::Bind(&P2PSocketHostTcpServer::OnAccepted, |
28 base::Unretained(this))) { | 29 base::Unretained(this))) { |
29 } | 30 } |
30 | 31 |
31 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { | 32 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { |
32 if (state_ == STATE_OPEN) { | 33 if (state_ == STATE_OPEN) { |
33 DCHECK(socket_.get()); | 34 DCHECK(socket_.get()); |
34 socket_.reset(); | 35 socket_.reset(); |
35 } | 36 } |
36 } | 37 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return std::move(result); | 144 return std::move(result); |
144 } | 145 } |
145 | 146 |
146 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, | 147 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, |
147 int value) { | 148 int value) { |
148 // Currently we don't have use case tcp server sockets are used for p2p. | 149 // Currently we don't have use case tcp server sockets are used for p2p. |
149 return false; | 150 return false; |
150 } | 151 } |
151 | 152 |
152 } // namespace content | 153 } // namespace content |
OLD | NEW |