Index: net/socket/stream_listen_socket.cc |
diff --git a/net/socket/stream_listen_socket.cc b/net/socket/stream_listen_socket.cc |
index d17ce75fec13cb91864d2832865a5cf033397622..e6ae74ef708c5359760d42b8bb08cfb8ac05f049 100644 |
--- a/net/socket/stream_listen_socket.cc |
+++ b/net/socket/stream_listen_socket.cc |
@@ -252,14 +252,11 @@ void StreamListenSocket::OnObjectSignaled(HANDLE object) { |
return; |
} |
- if (ev.lNetworkEvents & FD_CLOSE) { |
- Close(); |
- // Close might have deleted this object. We should return immediately. |
- return; |
+ if (!(ev.lNetworkEvents & FD_CLOSE)) { |
+ // The object was reset by WSAEnumNetworkEvents. Watch for the next signal. |
+ watcher_.StartWatching(object, this); |
} |
- // The object was reset by WSAEnumNetworkEvents. Watch for the next signal. |
- watcher_.StartWatching(object, this); |
if (ev.lNetworkEvents == 0) { |
// Occasionally the event is set even though there is no new data. |
@@ -274,10 +271,14 @@ void StreamListenSocket::OnObjectSignaled(HANDLE object) { |
has_pending_reads_ = true; |
} else { |
Read(); |
- // Read() might call Close() internally and 'this' can be invalid here |
- return; |
+ // Read doesn't call Close() in Windows case. We keep going. |
} |
} |
+ if (ev.lNetworkEvents & FD_CLOSE) { |
+ Close(); |
+ // Close might have deleted this object. We should return immediately. |
+ return; |
+ } |
} |
#elif defined(OS_POSIX) |
void StreamListenSocket::OnFileCanReadWithoutBlocking(int fd) { |