| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 patch class RawServerSocket { | 5 patch class RawServerSocket { |
| 6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1", | 6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1", |
| 7 int port = 0, | 7 int port = 0, |
| 8 int backlog = 0]) { | 8 int backlog = 0]) { |
| 9 return _RawServerSocket.bind(address, port, backlog); | 9 return _RawServerSocket.bind(address, port, backlog); |
| 10 } | 10 } |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 824 |
| 825 void _onPauseStateChange() { | 825 void _onPauseStateChange() { |
| 826 if (_raw != null) { | 826 if (_raw != null) { |
| 827 _raw.readEventsEnabled = !_controller.isPaused; | 827 _raw.readEventsEnabled = !_controller.isPaused; |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 | 830 |
| 831 void _onData(event) { | 831 void _onData(event) { |
| 832 switch (event) { | 832 switch (event) { |
| 833 case RawSocketEvent.READ: | 833 case RawSocketEvent.READ: |
| 834 _controller.add(_raw.read()); | 834 var buffer = _raw.read(); |
| 835 if (buffer != null) _controller.add(buffer); |
| 835 break; | 836 break; |
| 836 case RawSocketEvent.WRITE: | 837 case RawSocketEvent.WRITE: |
| 837 _consumer.write(); | 838 _consumer.write(); |
| 838 break; | 839 break; |
| 839 case RawSocketEvent.READ_CLOSED: | 840 case RawSocketEvent.READ_CLOSED: |
| 840 _controllerClosed = true; | 841 _controllerClosed = true; |
| 841 _controller.close(); | 842 _controller.close(); |
| 842 break; | 843 break; |
| 843 } | 844 } |
| 844 } | 845 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 _raw.onBadCertificate = callback; | 914 _raw.onBadCertificate = callback; |
| 914 } | 915 } |
| 915 | 916 |
| 916 X509Certificate get peerCertificate { | 917 X509Certificate get peerCertificate { |
| 917 if (_raw == null) { | 918 if (_raw == null) { |
| 918 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 919 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
| 919 } | 920 } |
| 920 return _raw.peerCertificate; | 921 return _raw.peerCertificate; |
| 921 } | 922 } |
| 922 } | 923 } |
| OLD | NEW |