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

Unified Diff: net/socket/tcp_server_socket.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_server_socket.h
diff --git a/net/socket/tcp_server_socket.h b/net/socket/tcp_server_socket.h
index 3b4a9616ede4bdbe921ab63f7f5a627ec70b1231..a4a5c05397ca84570546e8ee19e04c1a2379b18a 100644
--- a/net/socket/tcp_server_socket.h
+++ b/net/socket/tcp_server_socket.h
@@ -11,6 +11,7 @@
#include "net/base/ip_endpoint.h"
#include "net/base/net_export.h"
#include "net/socket/server_socket.h"
+#include "net/socket/socket_descriptor.h"
#include "net/socket/tcp_socket.h"
namespace net {
@@ -24,6 +25,11 @@ class NET_EXPORT TCPServerSocket : public ServerSocket {
TCPServerSocket(NetLog* net_log, const NetLogSource& source);
~TCPServerSocket() override;
+ // Takes ownership of |socket|, which has been opened, but may or may not be
+ // bound or listening. The caller must determine this based on the provenance
+ // of the socket and act accordingly.
+ int AdoptUnconnectedSocket(SocketDescriptor socket);
mmenke 2017/04/21 19:20:38 This works for connected sockets, too, right? May
Raul Vera 2017/05/01 05:35:25 It doesn't work for connected sockets, as the peer
+
// net::ServerSocket implementation.
int Listen(const IPEndPoint& address, int backlog) override;
int GetLocalAddress(IPEndPoint* address) const override;

Powered by Google App Engine
This is Rietveld 408576698