| Index: runtime/bin/io_service_patch.dart
|
| ===================================================================
|
| --- runtime/bin/io_service_patch.dart (revision 42788)
|
| +++ runtime/bin/io_service_patch.dart (working copy)
|
| @@ -20,7 +20,14 @@
|
| _initialize(index);
|
| var completer = new Completer();
|
| _messageMap[id] = completer;
|
| - _servicePort[index].send([id, _replyToPort, request, data]);
|
| + try {
|
| + _servicePort[index].send([id, _replyToPort, request, data]);
|
| + } catch (error) {
|
| + _messageMap.remove(id).complete(error);
|
| + if (_messageMap.length == 0) {
|
| + _finalize();
|
| + }
|
| + }
|
| return completer.future;
|
| }
|
|
|
| @@ -35,14 +42,18 @@
|
| assert(data is List && data.length == 2);
|
| _messageMap.remove(data[0]).complete(data[1]);
|
| if (_messageMap.length == 0) {
|
| - _id = 0;
|
| - _receivePort.close();
|
| - _receivePort = null;
|
| + _finalize();
|
| }
|
| };
|
| }
|
| }
|
|
|
| + static void _finalize() {
|
| + _id = 0;
|
| + _receivePort.close();
|
| + _receivePort = null;
|
| + }
|
| +
|
| static int _getNextId() {
|
| if (_id == 0x7FFFFFFF) _id = 0;
|
| return _id++;
|
|
|