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

Unified Diff: net/socket/tcp_socket_win.cc

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 | « net/socket/tcp_socket_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_socket_win.cc
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc
index 1ca554842c5c109fd2d20a111790e1f70daa9cb1..f96d678c6aeed7ef3b7aa8ddcd25e0f05bcbe922 100644
--- a/net/socket/tcp_socket_win.cc
+++ b/net/socket/tcp_socket_win.cc
@@ -284,7 +284,7 @@ int TCPSocketWin::Open(AddressFamily family) {
return OK;
}
-int TCPSocketWin::AdoptConnectedSocket(SOCKET socket,
+int TCPSocketWin::AdoptConnectedSocket(SocketDescriptor socket,
const IPEndPoint& peer_address) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(socket_, INVALID_SOCKET);
@@ -305,7 +305,7 @@ int TCPSocketWin::AdoptConnectedSocket(SOCKET socket,
return OK;
}
-int TCPSocketWin::AdoptListenSocket(SOCKET socket) {
+int TCPSocketWin::AdoptUnconnectedSocket(SocketDescriptor socket) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(socket_, INVALID_SOCKET);
@@ -729,6 +729,13 @@ void TCPSocketWin::EndLoggingMultipleConnectAttempts(int net_error) {
}
}
+SocketDescriptor TCPSocketWin::ReleaseSocketDescriptorForTesting() {
+ SocketDescriptor socket_descriptor = socket_;
+ socket_ = INVALID_SOCKET;
+ Close();
+ return socket_descriptor;
+}
+
int TCPSocketWin::AcceptInternal(std::unique_ptr<TCPSocketWin>* socket,
IPEndPoint* address) {
SockaddrStorage storage;
« no previous file with comments | « net/socket/tcp_socket_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698