| Index: runtime/bin/eventhandler_linux.cc
|
| diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
|
| index cd9805858e8150334fb6052e55b78109797445b0..4ff0865b81534fa5ee645724d89c5e7552ebe853 100644
|
| --- a/runtime/bin/eventhandler_linux.cc
|
| +++ b/runtime/bin/eventhandler_linux.cc
|
| @@ -222,9 +222,13 @@ void EventHandlerImplementation::HandleInterruptFd() {
|
| shutdown_ = true;
|
| } else {
|
| ASSERT((msg[i].data & COMMAND_MASK) != 0);
|
| -
|
| + Socket* socket = reinterpret_cast<Socket*>(msg[i].id);
|
| + RefCntReleaseScope<Socket> rs(socket);
|
| + if (socket->fd() == -1) {
|
| + continue;
|
| + }
|
| DescriptorInfo* di =
|
| - GetDescriptorInfo(msg[i].id, IS_LISTENING_SOCKET(msg[i].data));
|
| + GetDescriptorInfo(socket->fd(), IS_LISTENING_SOCKET(msg[i].data));
|
| if (IS_COMMAND(msg[i].data, kShutdownReadCommand)) {
|
| ASSERT(!di->IsListeningSocket());
|
| // Close the socket for reading.
|
| @@ -252,20 +256,21 @@ void EventHandlerImplementation::HandleInterruptFd() {
|
|
|
| MutexLocker locker(registry->mutex());
|
|
|
| - if (registry->CloseSafe(fd)) {
|
| + if (registry->CloseSafe(socket)) {
|
| ASSERT(new_mask == 0);
|
| socket_map_.Remove(GetHashmapKeyFromFd(fd),
|
| GetHashmapHashFromFd(fd));
|
| di->Close();
|
| delete di;
|
| + socket->SetClosedFd();
|
| }
|
| } else {
|
| ASSERT(new_mask == 0);
|
| socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd));
|
| di->Close();
|
| delete di;
|
| + socket->SetClosedFd();
|
| }
|
| -
|
| DartUtils::PostInt32(port, 1 << kDestroyedEvent);
|
| } else if (IS_COMMAND(msg[i].data, kReturnTokenCommand)) {
|
| int count = TOKEN_COUNT(msg[i].data);
|
| @@ -402,6 +407,7 @@ void EventHandlerImplementation::Poll(uword args) {
|
| handler_impl->HandleEvents(events, result);
|
| }
|
| }
|
| + DEBUG_ASSERT(ReferenceCounted<Socket>::instances() == 0);
|
| handler->NotifyShutdownDone();
|
| }
|
|
|
|
|