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(address, | 6 /* patch */ static Future<RawServerSocket> bind(address, |
7 int port, | 7 int port, |
8 {int backlog: 0, | 8 {int backlog: 0, |
9 bool v6Only: false}) { | 9 bool v6Only: false}) { |
10 return _RawServerSocket.bind(address, port, backlog, v6Only); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only); |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 860 } |
861 } catch (e) { | 861 } catch (e) { |
862 stop(); | 862 stop(); |
863 socket._consumerDone(); | 863 socket._consumerDone(); |
864 done(e); | 864 done(e); |
865 } | 865 } |
866 } | 866 } |
867 | 867 |
868 void done([error]) { | 868 void done([error]) { |
869 if (streamCompleter != null) { | 869 if (streamCompleter != null) { |
870 var tmp = streamCompleter; | 870 if (error != null) { |
| 871 streamCompleter.completeError(error); |
| 872 } else { |
| 873 streamCompleter.complete(socket); |
| 874 } |
871 streamCompleter = null; | 875 streamCompleter = null; |
872 if (error != null) { | |
873 tmp.completeError(error); | |
874 } else { | |
875 tmp.complete(socket); | |
876 } | |
877 } | 876 } |
878 } | 877 } |
879 | 878 |
880 void stop() { | 879 void stop() { |
881 if (subscription == null) return; | 880 if (subscription == null) return; |
882 subscription.cancel(); | 881 subscription.cancel(); |
883 subscription = null; | 882 subscription = null; |
884 socket._disableWriteEvent(); | 883 socket._disableWriteEvent(); |
885 } | 884 } |
886 } | 885 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 _raw.onBadCertificate = callback; | 1094 _raw.onBadCertificate = callback; |
1096 } | 1095 } |
1097 | 1096 |
1098 X509Certificate get peerCertificate { | 1097 X509Certificate get peerCertificate { |
1099 if (_raw == null) { | 1098 if (_raw == null) { |
1100 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 1099 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
1101 } | 1100 } |
1102 return _raw.peerCertificate; | 1101 return _raw.peerCertificate; |
1103 } | 1102 } |
1104 } | 1103 } |
OLD | NEW |