| Index: runtime/bin/eventhandler_win.cc
|
| diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
|
| index 7e1a2b33d96f2fe86e395926d108faa8084cba9b..fbc562398d297c730c1c9b84532b92653fae4465 100644
|
| --- a/runtime/bin/eventhandler_win.cc
|
| +++ b/runtime/bin/eventhandler_win.cc
|
| @@ -332,13 +332,30 @@ bool Handle::IssueSendTo(struct sockaddr* sa, socklen_t sa_len) {
|
| }
|
|
|
|
|
| +static void HandleClosed(Handle* handle) {
|
| + if (!handle->IsClosing()) {
|
| + int event_mask = 1 << kCloseEvent;
|
| + DartUtils::PostInt32(handle->port(), event_mask);
|
| + }
|
| +}
|
| +
|
| +
|
| +static void HandleError(Handle* handle) {
|
| + handle->set_last_error(WSAGetLastError());
|
| + handle->MarkError();
|
| + if (!handle->IsClosing()) {
|
| + int event_mask = 1 << kErrorEvent;
|
| + DartUtils::PostInt32(handle->port(), event_mask);
|
| + }
|
| +}
|
| +
|
| +
|
| void Handle::HandleIssueError() {
|
| DWORD error = GetLastError();
|
| - ASSERT(event_handler_ != NULL);
|
| if (error == ERROR_BROKEN_PIPE) {
|
| - event_handler_->HandleClosed(this);
|
| + HandleClosed(this);
|
| } else {
|
| - event_handler_->HandleError(this);
|
| + HandleError(this);
|
| }
|
| SetLastError(error);
|
| }
|
| @@ -400,11 +417,10 @@ bool DirectoryWatchHandle::IssueRead() {
|
|
|
| void SocketHandle::HandleIssueError() {
|
| int error = WSAGetLastError();
|
| - ASSERT(event_handler_ != NULL);
|
| if (error == WSAECONNRESET) {
|
| - event_handler_->HandleClosed(this);
|
| + HandleClosed(this);
|
| } else {
|
| - event_handler_->HandleError(this);
|
| + HandleError(this);
|
| }
|
| WSASetLastError(error);
|
| }
|
| @@ -547,7 +563,7 @@ ClientSocket* ListenSocket::Accept() {
|
| if (!IsClosing()) {
|
| while (pending_accept_count() < 5) {
|
| if (!IssueAccept()) {
|
| - event_handler_->HandleError(this);
|
| + HandleError(this);
|
| }
|
| }
|
| }
|
| @@ -1082,24 +1098,6 @@ void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket,
|
| }
|
|
|
|
|
| -void EventHandlerImplementation::HandleClosed(Handle* handle) {
|
| - if (!handle->IsClosing()) {
|
| - int event_mask = 1 << kCloseEvent;
|
| - DartUtils::PostInt32(handle->port(), event_mask);
|
| - }
|
| -}
|
| -
|
| -
|
| -void EventHandlerImplementation::HandleError(Handle* handle) {
|
| - handle->set_last_error(WSAGetLastError());
|
| - handle->MarkError();
|
| - if (!handle->IsClosing()) {
|
| - int event_mask = 1 << kErrorEvent;
|
| - DartUtils::PostInt32(handle->port(), event_mask);
|
| - }
|
| -}
|
| -
|
| -
|
| void EventHandlerImplementation::HandleRead(Handle* handle,
|
| int bytes,
|
| OverlappedBuffer* buffer) {
|
|
|