Chromium Code Reviews| 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); |
| + } |
| } |
| } |