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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 110223007: Handle failures to AcceptEx calls on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 7b5d66af420a192da74df9de40b6c8cc5eb700e4..bd0c3caa36ebc3f97839d3afe3d48c1dca286886 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -429,7 +429,6 @@ bool ListenSocket::LoadAcceptEx() {
bool ListenSocket::IssueAccept() {
ScopedLock lock(this);
-
// For AcceptEx there needs to be buffer storage for address
// information for two addresses (local and remote address). The
// AcceptEx documentation says: "This value must be at least 16
@@ -452,9 +451,10 @@ bool ListenSocket::IssueAccept() {
buffer->GetCleanOverlapped());
if (!ok) {
if (WSAGetLastError() != WSA_IO_PENDING) {
- Log::PrintErr("AcceptEx failed: %d\n", WSAGetLastError());
+ int error = WSAGetLastError();
closesocket(buffer->client());
OverlappedBuffer::DisposeBuffer(buffer);
+ WSASetLastError(error);
return false;
}
}
@@ -971,8 +971,12 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) {
DartUtils::PostInt32(handle->port(), event_mask);
}
// Always keep 5 outstanding accepts going, to enhance performance.
- while (listen_socket->pending_accept_count() < 5) {
- listen_socket->IssueAccept();
+ bool accept_success = true;
+ while (listen_socket->pending_accept_count() < 5 && accept_success) {
+ accept_success = listen_socket->IssueAccept();
+ if (!accept_success) {
Anders Johnsen 2013/12/18 16:24:33 Move issue-accept into if and remove the boolean,
Søren Gjesse 2014/01/02 08:37:33 Done.
+ HandleError(listen_socket);
+ }
}
}
« 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