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 "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 12 matching lines...) Expand all Loading... |
23 int socket_id, | 23 int socket_id, |
24 P2PSocketType client_type) | 24 P2PSocketType client_type) |
25 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::TCP), | 25 : P2PSocketHost(message_sender, socket_id, P2PSocketHost::TCP), |
26 client_type_(client_type), | 26 client_type_(client_type), |
27 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), | 27 socket_(new net::TCPServerSocket(NULL, net::NetLog::Source())), |
28 accept_callback_(base::Bind(&P2PSocketHostTcpServer::OnAccepted, | 28 accept_callback_(base::Bind(&P2PSocketHostTcpServer::OnAccepted, |
29 base::Unretained(this))) { | 29 base::Unretained(this))) { |
30 } | 30 } |
31 | 31 |
32 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { | 32 P2PSocketHostTcpServer::~P2PSocketHostTcpServer() { |
33 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(), | 33 base::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. | 42 // TODO(guidou): Add support for port range. |
43 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address, | 43 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address, |
44 uint16_t min_port, | 44 uint16_t min_port, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return result.release(); | 148 return result.release(); |
149 } | 149 } |
150 | 150 |
151 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, | 151 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, |
152 int value) { | 152 int value) { |
153 // 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. |
154 return false; | 154 return false; |
155 } | 155 } |
156 | 156 |
157 } // namespace content | 157 } // namespace content |
OLD | NEW |