Index: net/socket/tcp_socket_win.cc |
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc |
index 6d84fd453afac0ff4e0b2ac14af98839acbb7c4f..7ebac7c4d68dda240b32daf3bdba7749ca4217b2 100644 |
--- a/net/socket/tcp_socket_win.cc |
+++ b/net/socket/tcp_socket_win.cc |
@@ -801,30 +801,25 @@ int TCPSocketWin::DoConnect() { |
result = connect(socket_, storage.addr, storage.addr_len); |
} |
- if (!result) { |
- // Connected without waiting! |
- // |
- // The MSDN page for connect says: |
- // With a nonblocking socket, the connection attempt cannot be completed |
- // immediately. In this case, connect will return SOCKET_ERROR, and |
- // WSAGetLastError will return WSAEWOULDBLOCK. |
- // which implies that for a nonblocking socket, connect never returns 0. |
- // It's not documented whether the event object will be signaled or not |
- // if connect does return 0. So the code below is essentially dead code |
- // and we don't know if it's correct. |
- NOTREACHED(); |
- |
- if (ResetEventIfSignaled(core_->read_overlapped_.hEvent)) |
- return OK; |
- } else { |
- int os_error = WSAGetLastError(); |
- if (os_error != WSAEWOULDBLOCK) { |
- LOG(ERROR) << "connect failed: " << os_error; |
- connect_os_error_ = os_error; |
- int rv = MapConnectError(os_error); |
- CHECK_NE(ERR_IO_PENDING, rv); |
- return rv; |
- } |
+ // The MSDN page for connect says: |
+ // With a nonblocking socket, the connection attempt cannot be completed |
+ // immediately. In this case, connect will return SOCKET_ERROR, and |
+ // WSAGetLastError will return WSAEWOULDBLOCK. |
+ // which implies that for a nonblocking socket, connect never returns 0. |
+ // It's not clear what the correct thing to do is if connect() |
+ // returns 0. It's not clear whether this ever happens in practice. |
+ // This CHECK() is here to verify that it doesn't. |
+ // TODO(ricea): If the CHECK() fires in canary or dev, revert this |
+ // CL. If it doesn't, reconsider what we want to do here long-term. |
+ CHECK(result); |
+ |
+ int os_error = WSAGetLastError(); |
+ if (os_error != WSAEWOULDBLOCK) { |
+ LOG(ERROR) << "connect failed: " << os_error; |
+ connect_os_error_ = os_error; |
+ int rv = MapConnectError(os_error); |
+ CHECK_NE(ERR_IO_PENDING, rv); |
+ return rv; |
} |
// TODO(ricea): Remove ScopedTracker below once crbug.com/436634 is fixed. |