Fixed StreamListenSocket::OnObjectSignaled case when both FD_CLOSE and FD_READ are set.

BUG=379128

Review URL: https://codereview.chromium.org/315493003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274553 0039d316-1c4b-4281-b951-d872f2087c98
parent c28d4b75
......@@ -252,11 +252,16 @@ void StreamListenSocket::OnObjectSignaled(HANDLE object) {
return;
}
if (!(ev.lNetworkEvents & FD_CLOSE)) {
// The object was reset by WSAEnumNetworkEvents. Watch for the next signal.
watcher_.StartWatching(object, this);
// If both FD_CLOSE and FD_READ are set we only call Read().
// This will cause OnObjectSignaled to be called immediately again
// unless this socket is destroyed in Read().
if ((ev.lNetworkEvents & (FD_CLOSE | FD_READ)) == FD_CLOSE) {
Close();
// Close might have deleted this object. We should return immediately.
return;
}
// 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.
......@@ -271,14 +276,9 @@ void StreamListenSocket::OnObjectSignaled(HANDLE object) {
has_pending_reads_ = true;
} else {
Read();
// Read doesn't call Close() in Windows case. We keep going.
// Read might have deleted this object. We should return immediately.
}
}
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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment