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

Unified Diff: net/socket/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/socket_posix.h
diff --git a/net/socket/socket_posix.h b/net/socket/socket_posix.h
index 65a692e27de69604bef955deaea19ffa39efa01e..788a2d41dc22a8251aab52ee2c59c78465c75492 100644
--- a/net/socket/socket_posix.h
+++ b/net/socket/socket_posix.h
@@ -31,9 +31,16 @@ class NET_EXPORT_PRIVATE SocketPosix : public base::MessageLoopForIO::Watcher {
// Opens a socket and returns net::OK if |address_family| is AF_INET, AF_INET6
// or AF_UNIX. Otherwise, it does DCHECK() and returns a net error.
int Open(int address_family);
- // Takes ownership of |socket|.
+
+ // Takes ownership of |socket|, which is known to already be connected to the
+ // given peer address.
int AdoptConnectedSocket(SocketDescriptor socket,
const SockaddrStorage& 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
mmenke 2017/04/21 19:20:38 Since it may be open (Or may not), maybe just call
Raul Vera 2017/05/01 05:35:25 But that loses the symmetry with AdoptConnectedSoc
+ // provenance and act accordingly.
+ int AdoptUnconnectedSocket(SocketDescriptor socket);
+
// Releases ownership of |socket_fd_| to caller.
SocketDescriptor ReleaseConnectedSocket();

Powered by Google App Engine
This is Rietveld 408576698