Chromium Code Reviews| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 95 |
| 96 void TCPServerSocket::OnAcceptCompleted( | 96 void TCPServerSocket::OnAcceptCompleted( |
| 97 scoped_ptr<StreamSocket>* output_accepted_socket, | 97 scoped_ptr<StreamSocket>* output_accepted_socket, |
| 98 const CompletionCallback& forward_callback, | 98 const CompletionCallback& forward_callback, |
| 99 int result) { | 99 int result) { |
| 100 result = ConvertAcceptedSocket(result, output_accepted_socket); | 100 result = ConvertAcceptedSocket(result, output_accepted_socket); |
| 101 pending_accept_ = false; | 101 pending_accept_ = false; |
| 102 forward_callback.Run(result); | 102 forward_callback.Run(result); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // static | |
| 106 scoped_ptr<TCPServerSocket> TCPServerSocket::Create(const std::string& ip, | |
| 107 int port) { | |
| 108 IPAddressNumber ip_number; | |
| 109 if (!ParseIPLiteralToNumber(ip, &ip_number)) { | |
| 110 return scoped_ptr<TCPServerSocket>(); | |
| 111 } | |
| 112 scoped_ptr<TCPServerSocket> server_socket( | |
| 113 new TCPServerSocket(NULL, net::NetLog::Source())); | |
| 114 if (server_socket->Listen(net::IPEndPoint(ip_number, 0), 3) != OK) { | |
|
mmenke
2014/05/23 19:20:58
You should be passing in the port here.
mmenke
2014/05/23 19:20:58
Having a hard-coded backlog here seems like a bad
byungchul
2014/05/30 00:19:02
Done.
| |
| 115 return scoped_ptr<TCPServerSocket>(); | |
| 116 } | |
| 117 return server_socket.Pass(); | |
| 118 } | |
| 119 | |
| 105 } // namespace net | 120 } // namespace net |
| OLD | NEW |