| 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 extends NativeFieldWrapperClass1 { | 6 class _SocketBase extends NativeFieldWrapperClass1 { |
| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 bool _isPipe() => _pipe; | 469 bool _isPipe() => _pipe; |
| 470 | 470 |
| 471 InputStream get inputStream { | 471 InputStream get inputStream { |
| 472 if (_inputStream == null) { | 472 if (_inputStream == null) { |
| 473 if (_handlerMap[_SocketBase._IN_EVENT] !== null || | 473 if (_handlerMap[_SocketBase._IN_EVENT] !== null || |
| 474 _handlerMap[_SocketBase._CLOSE_EVENT] !== null) { | 474 _handlerMap[_SocketBase._CLOSE_EVENT] !== null) { |
| 475 throw new StreamException( | 475 throw new StreamException( |
| 476 "Cannot get input stream when socket handlers are used"); | 476 "Cannot get input stream when socket handlers are used"); |
| 477 } | 477 } |
| 478 _inputStream = new SocketInputStream(this); | 478 _inputStream = new _SocketInputStream(this); |
| 479 } | 479 } |
| 480 return _inputStream; | 480 return _inputStream; |
| 481 } | 481 } |
| 482 | 482 |
| 483 OutputStream get outputStream { | 483 OutputStream get outputStream { |
| 484 if (_outputStream == null) { | 484 if (_outputStream == null) { |
| 485 if (_handlerMap[_SocketBase._OUT_EVENT] !== null) { | 485 if (_handlerMap[_SocketBase._OUT_EVENT] !== null) { |
| 486 throw new StreamException( | 486 throw new StreamException( |
| 487 "Cannot get input stream when socket handlers are used"); | 487 "Cannot get input stream when socket handlers are used"); |
| 488 } | 488 } |
| 489 _outputStream = new SocketOutputStream(this); | 489 _outputStream = new _SocketOutputStream(this); |
| 490 } | 490 } |
| 491 return _outputStream; | 491 return _outputStream; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void set _onWrite(void callback()) { | 494 void set _onWrite(void callback()) { |
| 495 _setHandler(_SocketBase._OUT_EVENT, callback); | 495 _setHandler(_SocketBase._OUT_EVENT, callback); |
| 496 } | 496 } |
| 497 | 497 |
| 498 void set _onData(void callback()) { | 498 void set _onData(void callback()) { |
| 499 _setHandler(_SocketBase._IN_EVENT, callback); | 499 _setHandler(_SocketBase._IN_EVENT, callback); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 static void _ensureSocketService() { | 567 static void _ensureSocketService() { |
| 568 if (_socketService == null) { | 568 if (_socketService == null) { |
| 569 _socketService = _Socket._newServicePort(); | 569 _socketService = _Socket._newServicePort(); |
| 570 } | 570 } |
| 571 } | 571 } |
| 572 | 572 |
| 573 bool _seenFirstOutEvent = false; | 573 bool _seenFirstOutEvent = false; |
| 574 bool _pipe = false; | 574 bool _pipe = false; |
| 575 Function _clientConnectHandler; | 575 Function _clientConnectHandler; |
| 576 Function _clientWriteHandler; | 576 Function _clientWriteHandler; |
| 577 SocketInputStream _inputStream; | 577 _SocketInputStream _inputStream; |
| 578 SocketOutputStream _outputStream; | 578 _SocketOutputStream _outputStream; |
| 579 String _remoteHost; | 579 String _remoteHost; |
| 580 int _remotePort; | 580 int _remotePort; |
| 581 static SendPort _socketService; | 581 static SendPort _socketService; |
| 582 } | 582 } |
| OLD | NEW |