| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 class _SocketBase { | 6 class _SocketBase { |
| 7 // Bit flags used when communicating between the eventhandler and | 7 // Bit flags used when communicating between the eventhandler and |
| 8 // dart code. The EVENT flags are used to indicate events of | 8 // dart code. The EVENT flags are used to indicate events of |
| 9 // interest when sending a message from dart code to the | 9 // interest when sending a message from dart code to the |
| 10 // eventhandler. When receiving a message from the eventhandler the | 10 // eventhandler. When receiving a message from the eventhandler the |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 void _getPort() native "Socket_GetPort"; | 92 void _getPort() native "Socket_GetPort"; |
| 93 | 93 |
| 94 void set errorHandler(void callback()) { | 94 void set errorHandler(void callback()) { |
| 95 _setHandler(_ERROR_EVENT, callback); | 95 _setHandler(_ERROR_EVENT, callback); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void _activateHandlers() { | 98 void _activateHandlers() { |
| 99 if (_canActivateHandlers && (_id >= 0)) { | 99 if (_canActivateHandlers && (_id >= 0)) { |
| 100 if (_handlerMask == 0) { |
| 101 if (_handler != null) { |
| 102 _handler.close(); |
| 103 _handler = null; |
| 104 } |
| 105 return; |
| 106 } |
| 100 int data = _handlerMask; | 107 int data = _handlerMask; |
| 101 if (_isListenSocket()) { | 108 if (_isListenSocket()) { |
| 102 data |= (1 << _LISTENING_SOCKET); | 109 data |= (1 << _LISTENING_SOCKET); |
| 103 } else { | 110 } else { |
| 104 if (_closedRead) { data &= ~(1 << _IN_EVENT); } | 111 if (_closedRead) { data &= ~(1 << _IN_EVENT); } |
| 105 if (_closedWrite) { data &= ~(1 << _OUT_EVENT); } | 112 if (_closedWrite) { data &= ~(1 << _OUT_EVENT); } |
| 106 if (_isPipe()) data |= (1 << _PIPE); | 113 if (_isPipe()) data |= (1 << _PIPE); |
| 107 } | 114 } |
| 108 _sendToEventHandler(data); | 115 _sendToEventHandler(data); |
| 109 } | 116 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 bool _seenFirstOutEvent = false; | 472 bool _seenFirstOutEvent = false; |
| 466 bool _closedRead = false; | 473 bool _closedRead = false; |
| 467 bool _closedWrite = false; | 474 bool _closedWrite = false; |
| 468 bool _pipe = false; | 475 bool _pipe = false; |
| 469 Function _clientConnectHandler; | 476 Function _clientConnectHandler; |
| 470 Function _clientWriteHandler; | 477 Function _clientWriteHandler; |
| 471 SocketInputStream _inputStream; | 478 SocketInputStream _inputStream; |
| 472 SocketOutputStream _outputStream; | 479 SocketOutputStream _outputStream; |
| 473 } | 480 } |
| 474 | 481 |
| OLD | NEW |