Index: runtime/bin/eventhandler_win.cc |
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc |
index 332f80f8731b815081b89952e165b2d3fd6cb7d6..df9b5b6a36d40017aa693a7c01376d5db67361a2 100644 |
--- a/runtime/bin/eventhandler_win.cc |
+++ b/runtime/bin/eventhandler_win.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
@@ -324,7 +324,7 @@ void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) { |
bool FileHandle::IsClosed() { |
- return false; |
+ return IsClosing(); |
} |
@@ -573,7 +573,7 @@ void ClientSocket::Shutdown(int how) { |
void ClientSocket::DoClose() { |
- // Always do a suhtdown before initiating a disconnect. |
+ // Always do a shutdown before initiating a disconnect. |
shutdown(socket(), SD_BOTH); |
IssueDisconnect(); |
} |
@@ -630,12 +630,14 @@ bool ClientSocket::IssueWrite() { |
void ClientSocket::IssueDisconnect() { |
+ Dart_Port p = port(); |
IOBuffer* buffer = IOBuffer::AllocateDisconnectBuffer(); |
BOOL ok = DisconnectEx_( |
socket(), buffer->GetCleanOverlapped(), TF_REUSE_SOCKET, 0); |
if (!ok && WSAGetLastError() != WSA_IO_PENDING) { |
DisconnectComplete(buffer); |
} |
+ if (p != ILLEGAL_PORT) DartUtils::PostInt32(p, 1 << kDestroyedEvent); |
kustermann
2013/07/18 11:34:46
If you closed a socket with 'DisconnectEx_' then y
Anders Johnsen
2013/07/19 10:49:07
In Socket::Connect we can end up creating a socket
|
} |
@@ -756,6 +758,7 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { |
} |
if ((msg->data & (1 << kCloseCommand)) != 0) { |
+ handle->SetPortAndMask(msg->dart_port, msg->data); |
handle->Close(); |
kustermann
2013/07/18 11:34:46
I thought 'handle->Close()' will result in 'IssueD
Anders Johnsen
2013/07/19 10:49:07
It will, but this is for more kinds than just Clie
|
if (handle->IsClosed()) { |
delete_handle = true; |
@@ -763,7 +766,9 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) { |
} |
} |
if (delete_handle) { |
+ Dart_Port port = handle->port(); |
delete handle; |
+ DartUtils::PostInt32(port, 1 << kDestroyedEvent); |
kustermann
2013/07/18 11:34:46
Why do you do it here again?
Anders Johnsen
2013/07/19 10:49:07
ClientSocket will never be delete any other place
|
} |
} |
} |
@@ -781,7 +786,9 @@ void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket, |
} |
if (listen_socket->IsClosed()) { |
+ Dart_Port port = listen_socket->port(); |
delete listen_socket; |
+ DartUtils::PostInt32(port, 1 << kDestroyedEvent); |
kustermann
2013/07/18 11:34:46
I don't understand why these PostInt32(kDestroyEve
Anders Johnsen
2013/07/19 10:49:07
Every time we delete a socket, we send a destroy e
|
} |
} |
@@ -826,7 +833,9 @@ void EventHandlerImplementation::HandleRead(Handle* handle, |
} |
if (handle->IsClosed()) { |
+ Dart_Port port = handle->port(); |
delete handle; |
+ DartUtils::PostInt32(port, 1 << kDestroyedEvent); |
} |
} |
@@ -850,7 +859,9 @@ void EventHandlerImplementation::HandleWrite(Handle* handle, |
} |
if (handle->IsClosed()) { |
+ Dart_Port port = handle->port(); |
delete handle; |
+ DartUtils::PostInt32(port, 1 << kDestroyedEvent); |
} |
} |