Chromium Code Reviews| Index: net/socket/tcp_client_socket_win.cc |
| =================================================================== |
| --- net/socket/tcp_client_socket_win.cc (revision 185592) |
| +++ net/socket/tcp_client_socket_win.cc (working copy) |
| @@ -957,7 +957,6 @@ |
| DWORD num_bytes, flags; |
| BOOL ok = WSAGetOverlappedResult(socket_, &core_->read_overlapped_, |
| &num_bytes, FALSE, &flags); |
| - WSAResetEvent(core_->read_overlapped_.hEvent); |
| waiting_read_ = false; |
| int rv; |
| if (ok) { |
| @@ -975,6 +974,7 @@ |
| net_log_.AddEvent(NetLog::TYPE_SOCKET_READ_ERROR, |
| CreateNetLogSocketErrorCallback(rv, os_error)); |
| } |
| + WSAResetEvent(core_->read_overlapped_.hEvent); |
|
wtc
2013/03/05 20:17:03
This change is just defensive programming. Between
|
| core_->read_iobuffer_ = NULL; |
| core_->read_buffer_length_ = 0; |
| DoReadCallback(rv); |
| @@ -1026,13 +1026,22 @@ |
| os_error = WSAGetLastError(); |
| rv = MapSystemError(os_error); |
| } else if (network_events.lNetworkEvents & FD_READ) { |
| - rv = DoRead(core_->read_iobuffer_, core_->read_buffer_length_, |
| - read_callback_); |
| - if (rv == ERR_IO_PENDING) |
| - return; |
| + if (network_events.iErrorCode[FD_READ_BIT]) { |
|
wtc
2013/03/05 20:17:03
According to MSDN documentation and the sample cod
rvargas (doing something else)
2013/03/05 23:14:07
could you point me to that sample?
wtc
2013/03/06 00:00:03
I will bring the book to the office tomorrow.
rvargas (doing something else)
2013/03/06 00:34:47
That's ok. We agree that it is better to add the c
Pat Meenan
2013/03/06 02:05:28
In theory the FD_CLOSE is supposed to stay signale
|
| + os_error = network_events.iErrorCode[FD_READ_BIT]; |
| + rv = MapSystemError(os_error); |
| + net_log_.AddEvent(NetLog::TYPE_SOCKET_READ_ERROR, |
| + CreateNetLogSocketErrorCallback(rv, os_error)); |
| + } else { |
| + rv = DoRead(core_->read_iobuffer_, core_->read_buffer_length_, |
| + read_callback_); |
| + if (rv == ERR_IO_PENDING) |
| + return; |
| + } |
| } else if (network_events.lNetworkEvents & FD_CLOSE) { |
| + DCHECK_EQ(network_events.lNetworkEvents & ~FD_CLOSE, 0); |
| if (network_events.iErrorCode[FD_CLOSE_BIT]) { |
| - rv = MapSystemError(network_events.iErrorCode[FD_CLOSE_BIT]); |
| + os_error = network_events.iErrorCode[FD_CLOSE_BIT]; |
| + rv = MapSystemError(os_error); |
| net_log_.AddEvent(NetLog::TYPE_SOCKET_READ_ERROR, |
| CreateNetLogSocketErrorCallback(rv, os_error)); |
|
wtc
2013/03/05 20:17:03
This is the bug. Note that we map
network_events.i
|
| } else { |