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.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
6 | 6 |
7 #include "content/common/p2p_messages.h" | 7 #include "content/common/p2p_messages.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 P2PSocketHostTcp::~P2PSocketHostTcp() { | 33 P2PSocketHostTcp::~P2PSocketHostTcp() { |
34 if (state_ == STATE_OPEN) { | 34 if (state_ == STATE_OPEN) { |
35 DCHECK(socket_.get()); | 35 DCHECK(socket_.get()); |
36 socket_.reset(); | 36 socket_.reset(); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 bool P2PSocketHostTcp::InitAccepted(const net::IPEndPoint& remote_address, | 40 bool P2PSocketHostTcp::InitAccepted(const net::IPEndPoint& remote_address, |
41 net::ClientSocket* socket) { | 41 net::StreamSocket* socket) { |
42 DCHECK(socket); | 42 DCHECK(socket); |
43 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 43 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
44 | 44 |
45 remote_address_ = remote_address; | 45 remote_address_ = remote_address; |
46 socket_.reset(socket); | 46 socket_.reset(socket); |
47 state_ = STATE_OPEN; | 47 state_ = STATE_OPEN; |
48 DoRead(); | 48 DoRead(); |
49 return state_ != STATE_ERROR; | 49 return state_ != STATE_ERROR; |
50 } | 50 } |
51 | 51 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 DoWrite(); | 258 DoWrite(); |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( | 262 P2PSocketHost* P2PSocketHostTcp::AcceptIncomingTcpConnection( |
263 const net::IPEndPoint& remote_address, int id) { | 263 const net::IPEndPoint& remote_address, int id) { |
264 NOTREACHED(); | 264 NOTREACHED(); |
265 OnError(); | 265 OnError(); |
266 return NULL; | 266 return NULL; |
267 } | 267 } |
OLD | NEW |