| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (offset < 0) throw new RangeError.value(offset); | 168 if (offset < 0) throw new RangeError.value(offset); |
| 169 if (bytes < 0) throw new RangeError.value(bytes); | 169 if (bytes < 0) throw new RangeError.value(bytes); |
| 170 if ((offset + bytes) > buffer.length) { | 170 if ((offset + bytes) > buffer.length) { |
| 171 throw new RangeError.value(offset + bytes); | 171 throw new RangeError.value(offset + bytes); |
| 172 } | 172 } |
| 173 if (offset is! int || bytes is! int) { | 173 if (offset is! int || bytes is! int) { |
| 174 throw new ArgumentError("Invalid arguments to write on Socket"); | 174 throw new ArgumentError("Invalid arguments to write on Socket"); |
| 175 } | 175 } |
| 176 if (isClosed) return 0; | 176 if (isClosed) return 0; |
| 177 if (bytes == 0) return 0; | 177 if (bytes == 0) return 0; |
| 178 _BufferAndOffset bufferAndOffset = | 178 _BufferAndStart bufferAndStart = |
| 179 _ensureFastAndSerializableBuffer(buffer, offset, bytes); | 179 _ensureFastAndSerializableBuffer(buffer, offset, offset + bytes); |
| 180 var result = | 180 var result = |
| 181 nativeWrite(bufferAndOffset.buffer, bufferAndOffset.offset, bytes); | 181 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); |
| 182 if (result is OSError) { | 182 if (result is OSError) { |
| 183 reportError(result, "Write failed"); | 183 reportError(result, "Write failed"); |
| 184 result = 0; | 184 result = 0; |
| 185 } | 185 } |
| 186 return result; | 186 return result; |
| 187 } | 187 } |
| 188 | 188 |
| 189 _NativeSocket accept() { | 189 _NativeSocket accept() { |
| 190 var socket = new _NativeSocket.normal(); | 190 var socket = new _NativeSocket.normal(); |
| 191 if (nativeAccept(socket) != true) return null; | 191 if (nativeAccept(socket) != true) return null; |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 _raw.onBadCertificate = callback; | 941 _raw.onBadCertificate = callback; |
| 942 } | 942 } |
| 943 | 943 |
| 944 X509Certificate get peerCertificate { | 944 X509Certificate get peerCertificate { |
| 945 if (_raw == null) { | 945 if (_raw == null) { |
| 946 throw new StateError("peerCertificate called on destroyed SecureSocket"); | 946 throw new StateError("peerCertificate called on destroyed SecureSocket"); |
| 947 } | 947 } |
| 948 return _raw.peerCertificate; | 948 return _raw.peerCertificate; |
| 949 } | 949 } |
| 950 } | 950 } |
| OLD | NEW |