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 23 matching lines...) Expand all Loading... |
34 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(), | 34 STLDeleteContainerPairSecondPointers(accepted_sockets_.begin(), |
35 accepted_sockets_.end()); | 35 accepted_sockets_.end()); |
36 | 36 |
37 if (state_ == STATE_OPEN) { | 37 if (state_ == STATE_OPEN) { |
38 DCHECK(socket_.get()); | 38 DCHECK(socket_.get()); |
39 socket_.reset(); | 39 socket_.reset(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address, | 43 bool P2PSocketHostTcpServer::Init(const net::IPEndPoint& local_address, |
44 const net::IPEndPoint& remote_address) { | 44 const P2PHostAndIPEndPoint& remote_address) { |
45 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 45 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
46 | 46 |
47 int result = socket_->Listen(local_address, kListenBacklog); | 47 int result = socket_->Listen(local_address, kListenBacklog); |
48 if (result < 0) { | 48 if (result < 0) { |
49 LOG(ERROR) << "Listen() failed: " << result; | 49 LOG(ERROR) << "Listen() failed: " << result; |
50 OnError(); | 50 OnError(); |
51 return false; | 51 return false; |
52 } | 52 } |
53 | 53 |
54 result = socket_->GetLocalAddress(&local_address_); | 54 result = socket_->GetLocalAddress(&local_address_); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return result.release(); | 143 return result.release(); |
144 } | 144 } |
145 | 145 |
146 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, | 146 bool P2PSocketHostTcpServer::SetOption(P2PSocketOption option, |
147 int value) { | 147 int value) { |
148 // Currently we don't have use case tcp server sockets are used for p2p. | 148 // Currently we don't have use case tcp server sockets are used for p2p. |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 } // namespace content | 152 } // namespace content |
OLD | NEW |