| 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 _onWrite = null; | 542 _onWrite = null; |
| 543 } else { | 543 } else { |
| 544 if (_seenFirstOutEvent) { | 544 if (_seenFirstOutEvent) { |
| 545 _onWrite = _clientWriteHandler; | 545 _onWrite = _clientWriteHandler; |
| 546 } else { | 546 } else { |
| 547 _onWrite = firstWriteHandler; | 547 _onWrite = firstWriteHandler; |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 | 551 |
| 552 int get remotePort() { |
| 553 if (_remotePort === null) { |
| 554 _remotePort = _getRemotePort(); |
| 555 } |
| 556 return _remotePort; |
| 557 } |
| 558 |
| 559 int _getRemotePort() native "Socket_GetRemotePort"; |
| 560 |
| 552 static SendPort _newServicePort() native "Socket_NewServicePort"; | 561 static SendPort _newServicePort() native "Socket_NewServicePort"; |
| 553 | 562 |
| 554 static void _ensureSocketService() { | 563 static void _ensureSocketService() { |
| 555 if (_socketService == null) { | 564 if (_socketService == null) { |
| 556 _socketService = _Socket._newServicePort(); | 565 _socketService = _Socket._newServicePort(); |
| 557 } | 566 } |
| 558 } | 567 } |
| 559 | 568 |
| 560 bool _seenFirstOutEvent = false; | 569 bool _seenFirstOutEvent = false; |
| 561 bool _pipe = false; | 570 bool _pipe = false; |
| 562 Function _clientConnectHandler; | 571 Function _clientConnectHandler; |
| 563 Function _clientWriteHandler; | 572 Function _clientWriteHandler; |
| 564 SocketInputStream _inputStream; | 573 SocketInputStream _inputStream; |
| 565 SocketOutputStream _outputStream; | 574 SocketOutputStream _outputStream; |
| 575 int _remotePort; |
| 566 static SendPort _socketService; | 576 static SendPort _socketService; |
| 567 } | 577 } |
| OLD | NEW |