OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/socket/tcp_server_socket.h" | 5 #include "net/socket/tcp_server_socket.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/socket/tcp_client_socket.h" | 13 #include "net/socket/tcp_client_socket.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 TCPServerSocket::TCPServerSocket(NetLog* net_log, const NetLog::Source& source) | 17 TCPServerSocket::TCPServerSocket(NetLog* net_log, const NetLogSource& source) |
18 : socket_(nullptr, net_log, source), pending_accept_(false) {} | 18 : socket_(nullptr, net_log, source), pending_accept_(false) {} |
19 | 19 |
20 TCPServerSocket::~TCPServerSocket() { | 20 TCPServerSocket::~TCPServerSocket() { |
21 } | 21 } |
22 | 22 |
23 int TCPServerSocket::Listen(const IPEndPoint& address, int backlog) { | 23 int TCPServerSocket::Listen(const IPEndPoint& address, int backlog) { |
24 int result = socket_.Open(address.GetFamily()); | 24 int result = socket_.Open(address.GetFamily()); |
25 if (result != OK) | 25 if (result != OK) |
26 return result; | 26 return result; |
27 | 27 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void TCPServerSocket::OnAcceptCompleted( | 100 void TCPServerSocket::OnAcceptCompleted( |
101 std::unique_ptr<StreamSocket>* output_accepted_socket, | 101 std::unique_ptr<StreamSocket>* output_accepted_socket, |
102 const CompletionCallback& forward_callback, | 102 const CompletionCallback& forward_callback, |
103 int result) { | 103 int result) { |
104 result = ConvertAcceptedSocket(result, output_accepted_socket); | 104 result = ConvertAcceptedSocket(result, output_accepted_socket); |
105 pending_accept_ = false; | 105 pending_accept_ = false; |
106 forward_callback.Run(result); | 106 forward_callback.Run(result); |
107 } | 107 } |
108 | 108 |
109 } // namespace net | 109 } // namespace net |
OLD | NEW |