| 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 _raw.writeEventsEnabled = true; | 895 _raw.writeEventsEnabled = true; |
| 896 } | 896 } |
| 897 | 897 |
| 898 void _disableWriteEvent() { | 898 void _disableWriteEvent() { |
| 899 if (_raw != null) { | 899 if (_raw != null) { |
| 900 _raw.writeEventsEnabled = false; | 900 _raw.writeEventsEnabled = false; |
| 901 } | 901 } |
| 902 } | 902 } |
| 903 | 903 |
| 904 void _consumerDone([error]) { | 904 void _consumerDone([error]) { |
| 905 _done(error); |
| 905 if (_raw != null) { | 906 if (_raw != null) { |
| 906 _raw.shutdown(SocketDirection.SEND); | 907 _raw.shutdown(SocketDirection.SEND); |
| 907 _disableWriteEvent(); | 908 _disableWriteEvent(); |
| 908 } | 909 } |
| 909 _done(error); | |
| 910 } | 910 } |
| 911 } | 911 } |
| 912 | 912 |
| 913 | 913 |
| 914 class _SecureSocket extends _Socket implements SecureSocket { | 914 class _SecureSocket extends _Socket implements SecureSocket { |
| 915 _SecureSocket(RawSecureSocket raw) : super(raw); | 915 _SecureSocket(RawSecureSocket raw) : super(raw); |
| 916 | 916 |
| 917 void set onBadCertificate(bool callback(X509Certificate certificate)) { | 917 void set onBadCertificate(bool callback(X509Certificate certificate)) { |
| 918 if (_raw == null) { | 918 if (_raw == null) { |
| 919 throw new StateError("onBadCertificate called on destroyed SecureSocket"); | 919 throw new StateError("onBadCertificate called on destroyed SecureSocket"); |
| 920 } | 920 } |
| 921 _raw.onBadCertificate = callback; | 921 _raw.onBadCertificate = callback; |
| 922 } | 922 } |
| 923 | 923 |
| 924 X509Certificate get peerCertificate { | 924 X509Certificate get peerCertificate { |
| 925 if (_raw == null) { | 925 if (_raw == null) { |
| 926 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 926 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
| 927 } | 927 } |
| 928 return _raw.peerCertificate; | 928 return _raw.peerCertificate; |
| 929 } | 929 } |
| 930 } | 930 } |
| OLD | NEW |