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

Unified Diff: net/socket/stream_listen_socket.cc

Issue 315493003: Fixed StreamListenSocket::OnObjectSignaled case when both FD_CLOSE and FD_READ are set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/stream_listen_socket.cc
diff --git a/net/socket/stream_listen_socket.cc b/net/socket/stream_listen_socket.cc
index e6ae74ef708c5359760d42b8bb08cfb8ac05f049..fd164a556d5b3f0235794e4e939be61f4cd7459d 100644
--- a/net/socket/stream_listen_socket.cc
+++ b/net/socket/stream_listen_socket.cc
@@ -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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698