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 NetLog::Source& source) |
18 : socket_(net_log, source), | 18 : socket_(NULL, net_log, source), pending_accept_(false) {} |
19 pending_accept_(false) { | |
20 } | |
21 | 19 |
22 TCPServerSocket::~TCPServerSocket() { | 20 TCPServerSocket::~TCPServerSocket() { |
23 } | 21 } |
24 | 22 |
25 int TCPServerSocket::Listen(const IPEndPoint& address, int backlog) { | 23 int TCPServerSocket::Listen(const IPEndPoint& address, int backlog) { |
26 int result = socket_.Open(address.GetFamily()); | 24 int result = socket_.Open(address.GetFamily()); |
27 if (result != OK) | 25 if (result != OK) |
28 return result; | 26 return result; |
29 | 27 |
30 result = socket_.SetDefaultOptionsForServer(); | 28 result = socket_.SetDefaultOptionsForServer(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void TCPServerSocket::OnAcceptCompleted( | 100 void TCPServerSocket::OnAcceptCompleted( |
103 scoped_ptr<StreamSocket>* output_accepted_socket, | 101 scoped_ptr<StreamSocket>* output_accepted_socket, |
104 const CompletionCallback& forward_callback, | 102 const CompletionCallback& forward_callback, |
105 int result) { | 103 int result) { |
106 result = ConvertAcceptedSocket(result, output_accepted_socket); | 104 result = ConvertAcceptedSocket(result, output_accepted_socket); |
107 pending_accept_ = false; | 105 pending_accept_ = false; |
108 forward_callback.Run(result); | 106 forward_callback.Run(result); |
109 } | 107 } |
110 | 108 |
111 } // namespace net | 109 } // namespace net |
OLD | NEW |