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.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
6 | 6 |
7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
12 #include "net/socket/tcp_client_socket.h" | 12 #include "net/socket/tcp_client_socket.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 const int kReadBufferSize = 4096; | 15 const int kReadBufferSize = 4096; |
16 const int kPacketHeaderSize = sizeof(uint16); | 16 const int kPacketHeaderSize = sizeof(uint16); |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 P2PSocketHostTcp::P2PSocketHostTcp(IPC::Message::Sender* message_sender, | 21 P2PSocketHostTcp::P2PSocketHostTcp(IPC::Sender* message_sender, |
22 int routing_id, int id) | 22 int routing_id, int id) |
23 : P2PSocketHost(message_sender, routing_id, id), | 23 : P2PSocketHost(message_sender, routing_id, id), |
24 connected_(false) { | 24 connected_(false) { |
25 } | 25 } |
26 | 26 |
27 P2PSocketHostTcp::~P2PSocketHostTcp() { | 27 P2PSocketHostTcp::~P2PSocketHostTcp() { |
28 if (state_ == STATE_OPEN) { | 28 if (state_ == STATE_OPEN) { |
29 DCHECK(socket_.get()); | 29 DCHECK(socket_.get()); |
30 socket_.reset(); | 30 socket_.reset(); |
31 } | 31 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( | 270 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( |
271 const net::IPEndPoint& remote_address, int id) { | 271 const net::IPEndPoint& remote_address, int id) { |
272 NOTREACHED(); | 272 NOTREACHED(); |
273 OnError(); | 273 OnError(); |
274 return NULL; | 274 return NULL; |
275 } | 275 } |
276 | 276 |
277 } // namespace content | 277 } // namespace content |
OLD | NEW |