Chromium Code Reviews| Index: net/socket/tcp_socket_win.h |
| diff --git a/net/socket/tcp_socket_win.h b/net/socket/tcp_socket_win.h |
| index 1cefdca0a2965fe4cab7fa3c7a87be03210c021a..c78c3def659d1aec69526692e052e0a27b3d8771 100644 |
| --- a/net/socket/tcp_socket_win.h |
| +++ b/net/socket/tcp_socket_win.h |
| @@ -19,6 +19,7 @@ |
| #include "net/base/completion_callback.h" |
| #include "net/base/net_export.h" |
| #include "net/log/net_log_with_source.h" |
| +#include "net/socket/socket_descriptor.h" |
| #include "net/socket/socket_performance_watcher.h" |
| namespace net { |
| @@ -40,12 +41,16 @@ class NET_EXPORT TCPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe), |
| int Open(AddressFamily family); |
| - // Both AdoptConnectedSocket and AdoptListenSocket take ownership of an |
| - // existing socket. AdoptConnectedSocket takes an already connected |
| - // socket. AdoptListenSocket takes a socket that is intended to accept |
| - // connection. In some sense, AdoptListenSocket is more similar to Open. |
| - int AdoptConnectedSocket(SOCKET socket, const IPEndPoint& peer_address); |
| - int AdoptListenSocket(SOCKET socket); |
| + // Takes ownership of |socket|, which is known to already be connected to the |
| + // given peer address. However, peer address may be the empty address, for |
| + // compatibility. The given peer address will be returned by GetPeerAddress. |
| + int AdoptConnectedSocket(SocketDescriptor socket, |
| + const IPEndPoint& peer_address); |
| + // Takes ownership of |socket|, which may or may not be open, bound, or |
| + // listening. The caller must determine the state of the socket based on its |
| + // provenance and act accordingly. The socket may have connections waiting |
| + // to be accepted, but must not be actually connected. |
| + int AdoptUnconnectedSocket(SocketDescriptor socket); |
| int Bind(const IPEndPoint& address); |
| @@ -115,6 +120,9 @@ class NET_EXPORT TCPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe), |
| const NetLogWithSource& net_log() const { return net_log_; } |
| + // Used only for testing. |
| + SocketDescriptor GetSocketDescriptor() const { return socket_; } |
|
mmenke
2017/05/01 18:44:19
GetSocketDescriptorForTesting
Raul Vera
2017/05/02 00:08:53
Done.
|
| + |
| private: |
| class Core; |