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

Unified Diff: net/socket/socket_posix.h

Issue 2815993002: Adds a method to TCPServerSocket to adopt a socket. (Closed)
Patch Set: Refined GetSocketDescriptor per review. 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
« no previous file with comments | « device/bluetooth/bluetooth_socket_win.cc ('k') | net/socket/socket_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_posix.h
diff --git a/net/socket/socket_posix.h b/net/socket/socket_posix.h
index 65a692e27de69604bef955deaea19ffa39efa01e..04ef7f6cb952acdb684d25095d873707b27fce56 100644
--- a/net/socket/socket_posix.h
+++ b/net/socket/socket_posix.h
@@ -31,9 +31,17 @@ 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
+ // provenance and act accordingly. The socket may have connections waiting
+ // to be accepted, but must not be actually connected.
+ int AdoptUnconnectedSocket(SocketDescriptor socket);
+
// Releases ownership of |socket_fd_| to caller.
SocketDescriptor ReleaseConnectedSocket();
« no previous file with comments | « device/bluetooth/bluetooth_socket_win.cc ('k') | net/socket/socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698