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

Unified Diff: net/socket/tcp_socket_win.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_win.h
diff --git a/net/socket/tcp_socket_win.h b/net/socket/tcp_socket_win.h
index 1cefdca0a2965fe4cab7fa3c7a87be03210c021a..71d1a5bc95472a755de0e173a56e4e8a587a7b22 100644
--- a/net/socket/tcp_socket_win.h
+++ b/net/socket/tcp_socket_win.h
@@ -19,6 +19,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 net {
@@ -40,12 +41,15 @@ class NET_EXPORT TCPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe),
int Open(AddressFamily family);
- // Both AdoptConnectedSocket and AdoptListenSocket take ownership of an
- // existing socket. AdoptConnectedSocket takes an already connected
- // socket. AdoptListenSocket takes a socket that is intended to accept
- // connection. In some sense, AdoptListenSocket is more similar to Open.
- int AdoptConnectedSocket(SOCKET socket, const IPEndPoint& peer_address);
- int AdoptListenSocket(SOCKET socket);
+ // 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 SockaddrStorage& peer_address);
mmenke 2017/04/21 19:20:38 IPEndPoint
Raul Vera 2017/05/01 05:35:25 I guess you can tell I don't have a Windows machin
+ // 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