Chromium Code Reviews| Index: net/socket/tcp_socket_posix.h |
| diff --git a/net/socket/tcp_socket_posix.h b/net/socket/tcp_socket_posix.h |
| index f5ba10abc34a5f00916dffc3792dccda996e063f..65e2d218902733bf2bf360dd59daf5cbf50ab28b 100644 |
| --- a/net/socket/tcp_socket_posix.h |
| +++ b/net/socket/tcp_socket_posix.h |
| @@ -16,6 +16,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 base { |
| @@ -43,8 +44,16 @@ class NET_EXPORT TCPSocketPosix { |
| int Open(AddressFamily family); |
| - // Takes ownership of |socket_fd|. |
| - int AdoptConnectedSocket(int socket_fd, const IPEndPoint& peer_address); |
| + // 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); |
| @@ -113,6 +122,9 @@ class NET_EXPORT TCPSocketPosix { |
| const NetLogWithSource& net_log() const { return net_log_; } |
| + // Used only for testing. |
| + SocketDescriptor GetSocketDescriptor() const; |
|
mmenke
2017/05/01 18:44:19
GetSocketDescriptorForTesting()
(We have some che
Raul Vera
2017/05/02 00:08:53
That's very cool. Done. Thanks.
|
| + |
| private: |
| // States that using a socket with TCP FastOpen can lead to. |
| enum TCPFastOpenStatus { |