| 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 | 782 |
| 783 | 783 |
| 784 patch class Socket { | 784 patch class Socket { |
| 785 /* patch */ static Future<Socket> connect(host, int port) { | 785 /* patch */ static Future<Socket> connect(host, int port) { |
| 786 return RawSocket.connect(host, port).then( | 786 return RawSocket.connect(host, port).then( |
| 787 (socket) => new _Socket(socket)); | 787 (socket) => new _Socket(socket)); |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 | 790 |
| 791 | 791 |
| 792 patch class SecureSocket { | |
| 793 /* patch */ factory SecureSocket._(RawSecureSocket rawSocket) => | |
| 794 new _SecureSocket(rawSocket); | |
| 795 } | |
| 796 | |
| 797 | |
| 798 class _SocketStreamConsumer extends StreamConsumer<List<int>> { | 792 class _SocketStreamConsumer extends StreamConsumer<List<int>> { |
| 799 StreamSubscription subscription; | 793 StreamSubscription subscription; |
| 800 final _Socket socket; | 794 final _Socket socket; |
| 801 int offset; | 795 int offset; |
| 802 List<int> buffer; | 796 List<int> buffer; |
| 803 bool paused = false; | 797 bool paused = false; |
| 804 Completer streamCompleter; | 798 Completer streamCompleter; |
| 805 | 799 |
| 806 _SocketStreamConsumer(this.socket); | 800 _SocketStreamConsumer(this.socket); |
| 807 | 801 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 if (_detachReady != null) { | 1069 if (_detachReady != null) { |
| 1076 _detachReady.complete(null); | 1070 _detachReady.complete(null); |
| 1077 } else { | 1071 } else { |
| 1078 if (_raw != null) { | 1072 if (_raw != null) { |
| 1079 _raw.shutdown(SocketDirection.SEND); | 1073 _raw.shutdown(SocketDirection.SEND); |
| 1080 _disableWriteEvent(); | 1074 _disableWriteEvent(); |
| 1081 } | 1075 } |
| 1082 } | 1076 } |
| 1083 } | 1077 } |
| 1084 } | 1078 } |
| 1085 | |
| 1086 | |
| 1087 class _SecureSocket extends _Socket implements SecureSocket { | |
| 1088 _SecureSocket(RawSecureSocket raw) : super(raw); | |
| 1089 | |
| 1090 void set onBadCertificate(bool callback(X509Certificate certificate)) { | |
| 1091 if (_raw == null) { | |
| 1092 throw new StateError("onBadCertificate called on destroyed SecureSocket"); | |
| 1093 } | |
| 1094 _raw.onBadCertificate = callback; | |
| 1095 } | |
| 1096 | |
| 1097 X509Certificate get peerCertificate { | |
| 1098 if (_raw == null) { | |
| 1099 throw new StateError("peerCertificate called on destroyed SecureSocket"); | |
| 1100 } | |
| 1101 return _raw.peerCertificate; | |
| 1102 } | |
| 1103 } | |
| OLD | NEW |