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

Issue 12546004: Retrieve more accurate error code (WSAECONNRESET vs. (Closed)

Created:
7 years, 9 months ago by wtc
Modified:
7 years, 9 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

[Abandoned. Please see https://codereview.chromium.org/12468002/ instead.] Retrieve more accurate error code (WSAECONNRESET vs. WSAECONNABORTED) than what WSAEnumNetworkEvents reported in network_events.iErrorCode[FD_CLOSE_BIT} by calling recv() on the socket. Eliminate (or at least greatly reduce) spurious wakeups by reseting the event object when recv() returns a positive byte count. R=pmeenan@chromium.org,rvargas@chromium.org BUG=180313 TEST=none

Patch Set 1 #

Total comments: 16
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -10 lines) Patch
M net/socket/tcp_client_socket_win.cc View 4 chunks +10 lines, -10 lines 16 comments Download

Messages

Total messages: 4 (0 generated)
wtc
Here is an alternative patch for the WSAECONNABORTED vs. WSAECONNRESET problem when non-blocking reads are ...
7 years, 9 months ago (2013-03-06 17:33:43 UTC) #1
rvargas (doing something else)
https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_win.cc File net/socket/tcp_client_socket_win.cc (right): https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_win.cc#newcode864 net/socket/tcp_client_socket_win.cc:864: BOOL ok = WSAResetEvent(core_->read_overlapped_.hEvent); I think this can cause ...
7 years, 9 months ago (2013-03-06 23:08:49 UTC) #2
Pat Meenan
https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_win.cc File net/socket/tcp_client_socket_win.cc (right): https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_win.cc#newcode864 net/socket/tcp_client_socket_win.cc:864: BOOL ok = WSAResetEvent(core_->read_overlapped_.hEvent); On 2013/03/06 23:08:49, rvargas wrote: ...
7 years, 9 months ago (2013-03-07 15:11:04 UTC) #3
wtc
7 years, 9 months ago (2013-03-14 01:24:45 UTC) #4
Thank you both for your comments.

I will abandon this CL and move this approach to the original
CL.

https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_...
File net/socket/tcp_client_socket_win.cc (right):

https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_...
net/socket/tcp_client_socket_win.cc:1037: read_callback_);

On 2013/03/07 15:11:04, pmeenan1 wrote:
> 
> Is the last error from the recv() here as granular as the error code in the
> FD_CLOSE_BIT in the case of a close?

Yes, in fact it is better.

When the peer resets the connection, the error code in the
FD_CLOSE_BIT is WSAECONNABORTED, but the last error from
recv() is WSAECONNRESET, which is more accurate.

https://codereview.chromium.org/12546004/diff/1/net/socket/tcp_client_socket_...
net/socket/tcp_client_socket_win.cc:1042: // signaled but the network events
flags are all clear (0).

On 2013/03/07 15:11:04, pmeenan1 wrote:
>
> How often do the Spurious wake-ups happen from IsConnected() and
> IsConnectedAndIdle()?

I confirmed that the spurious wake-ups are NOT caused by
IsConnected() and IsConnectedAndIdle().  Under the current
code, spurious wake-ups are to be expected. 

> It's light enough in here that I'm much more comfortable
> just letting them happen than trying to manually toggle the event.  I'd just
> change the comment since you know what causes them to happen.

Done.

Powered by Google App Engine
This is Rietveld 408576698