| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (bytes < 0) throw new RangeError.value(bytes); | 292 if (bytes < 0) throw new RangeError.value(bytes); |
| 293 if ((offset + bytes) > buffer.length) { | 293 if ((offset + bytes) > buffer.length) { |
| 294 throw new RangeError.value(offset + bytes); | 294 throw new RangeError.value(offset + bytes); |
| 295 } | 295 } |
| 296 if (offset is! int || bytes is! int) { | 296 if (offset is! int || bytes is! int) { |
| 297 throw new ArgumentError("Invalid arguments to write on Socket"); | 297 throw new ArgumentError("Invalid arguments to write on Socket"); |
| 298 } | 298 } |
| 299 if (isClosed) return 0; | 299 if (isClosed) return 0; |
| 300 if (bytes == 0) return 0; | 300 if (bytes == 0) return 0; |
| 301 _BufferAndStart bufferAndStart = | 301 _BufferAndStart bufferAndStart = |
| 302 _ensureFastAndSerializableBuffer(buffer, offset, offset + bytes); | 302 _ensureFastAndSerializableByteData(buffer, offset, offset + bytes); |
| 303 var result = | 303 var result = |
| 304 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); | 304 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); |
| 305 if (result is OSError) { | 305 if (result is OSError) { |
| 306 reportError(result, "Write failed"); | 306 reportError(result, "Write failed"); |
| 307 result = 0; | 307 result = 0; |
| 308 } | 308 } |
| 309 return result; | 309 return result; |
| 310 } | 310 } |
| 311 | 311 |
| 312 _NativeSocket accept() { | 312 _NativeSocket accept() { |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 if (_detachReady != null) { | 1065 if (_detachReady != null) { |
| 1066 _detachReady.complete(null); | 1066 _detachReady.complete(null); |
| 1067 } else { | 1067 } else { |
| 1068 if (_raw != null) { | 1068 if (_raw != null) { |
| 1069 _raw.shutdown(SocketDirection.SEND); | 1069 _raw.shutdown(SocketDirection.SEND); |
| 1070 _disableWriteEvent(); | 1070 _disableWriteEvent(); |
| 1071 } | 1071 } |
| 1072 } | 1072 } |
| 1073 } | 1073 } |
| 1074 } | 1074 } |
| OLD | NEW |