diff options
-rw-r--r-- | net/base/tcp_client_socket_win.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/net/base/tcp_client_socket_win.cc b/net/base/tcp_client_socket_win.cc index dff0391b..8b15f38 100644 --- a/net/base/tcp_client_socket_win.cc +++ b/net/base/tcp_client_socket_win.cc @@ -215,7 +215,26 @@ int TCPClientSocket::Write(const char* buf, DWORD num; int rv = WSASend(socket_, &buffer_, 1, &num, 0, &overlapped_, NULL); if (rv == 0) { - CHECK(WaitForSingleObject(overlapped_.hEvent, 0) == WAIT_OBJECT_0); + // TODO(wtc): These temporary CHECKs are intended to determine the return + // value and error code of the WaitForSingleObject call if it doesn't + // return the expected WAIT_OBJECT_0. See http://crbug.com/6500. + DWORD wait_rv = WaitForSingleObject(overlapped_.hEvent, 0); + if (wait_rv != WAIT_OBJECT_0) { + if (wait_rv == WAIT_ABANDONED) { + CHECK(false); + } else if (wait_rv == WAIT_TIMEOUT) { + CHECK(false); + } else if (wait_rv == WAIT_FAILED) { + DWORD wait_error = GetLastError(); + if (wait_error == ERROR_INVALID_HANDLE) { + CHECK(false); + } else { + CHECK(false); + } + } else { + CHECK(false); + } + } BOOL ok = WSAResetEvent(overlapped_.hEvent); CHECK(ok); TRACE_EVENT_END("socket.write", this, StringPrintf("%d bytes", num)); |