Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Unified Diff: net/socket/tcp_socket_posix.h

Issue 2815993002: Adds a method to TCPServerSocket to adopt a socket. (Closed)
Patch Set: Rebased to fix merge conflict Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..0274056d2e7d53d8113490c57837d73a578dce6f 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,15 @@ 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.
+ int AdoptUnconnectedSocket(SocketDescriptor socket);
int Bind(const IPEndPoint& address);

Powered by Google App Engine
This is Rietveld 408576698