Index: runtime/vm/isolate.cc |
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
index fee9cbb8a331bacdbc54ac56479a4ceea34b69d5..061cf7cbc4a35844b1754e623a7709eb3e914dfc 100644 |
--- a/runtime/vm/isolate.cc |
+++ b/runtime/vm/isolate.cc |
@@ -89,6 +89,21 @@ bool IsolateMessageHandler::HandleMessage(Message* message) { |
StackZone zone(isolate_); |
HandleScope handle_scope(isolate_); |
+ // If the message is in band we lookup the receive port to dispatch to. If |
+ // the receive port is closed, we drop the message without deserializing it. |
+ Object& receive_port = Object::Handle(); |
+ if (!message->IsOOB()) { |
+ receive_port = DartLibraryCalls::LookupReceivePort(message->dest_port()); |
+ if (receive_port.IsError()) { |
+ return ProcessUnhandledException(Instance::Handle(), |
+ Error::Cast(receive_port)); |
+ } |
+ if (receive_port.IsNull()) { |
+ delete message; |
+ return true; |
+ } |
+ } |
+ |
// Parse the message. |
SnapshotReader reader(message->data(), message->len(), |
Snapshot::kMessage, Isolate::Current()); |
@@ -116,7 +131,7 @@ bool IsolateMessageHandler::HandleMessage(Message* message) { |
} else { |
const Object& result = Object::Handle( |
DartLibraryCalls::HandleMessage( |
- message->dest_port(), message->reply_port(), msg)); |
+ receive_port, message->reply_port(), msg)); |
if (result.IsError()) { |
success = ProcessUnhandledException(msg, Error::Cast(result)); |
} else { |