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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 } | 835 } |
836 | 836 |
837 void write() { | 837 void write() { |
838 try { | 838 try { |
839 if (subscription == null) return; | 839 if (subscription == null) return; |
840 assert(buffer != null); | 840 assert(buffer != null); |
841 // Write as much as possible. | 841 // Write as much as possible. |
842 offset += socket._write(buffer, offset, buffer.length - offset); | 842 offset += socket._write(buffer, offset, buffer.length - offset); |
843 if (offset < buffer.length) { | 843 if (offset < buffer.length) { |
844 if (!paused) { | 844 if (!paused) { |
845 paused = true; | |
846 // TODO(ajohnsen): It would be nice to avoid this check. | |
847 // Some info: socket._write can emit an event, if it fails to write. | |
848 // If the user closes the socket in that event, stop() will be called | |
849 // before we get a change to pause. | |
850 if (subscription == null) return; | |
851 subscription.pause(); | 845 subscription.pause(); |
852 } | 846 } |
853 socket._enableWriteEvent(); | 847 socket._enableWriteEvent(); |
854 } else { | 848 } else { |
855 buffer = null; | 849 buffer = null; |
856 if (paused) { | 850 if (paused) { |
857 paused = false; | 851 paused = false; |
858 subscription.resume(); | 852 subscription.resume(); |
859 } | 853 } |
860 } | 854 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 _raw.onBadCertificate = callback; | 1088 _raw.onBadCertificate = callback; |
1095 } | 1089 } |
1096 | 1090 |
1097 X509Certificate get peerCertificate { | 1091 X509Certificate get peerCertificate { |
1098 if (_raw == null) { | 1092 if (_raw == null) { |
1099 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 1093 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
1100 } | 1094 } |
1101 return _raw.peerCertificate; | 1095 return _raw.peerCertificate; |
1102 } | 1096 } |
1103 } | 1097 } |
OLD | NEW |