| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (offset is! int || bytes is! int) { | 458 if (offset is! int || bytes is! int) { |
| 459 throw new ArgumentError("Invalid arguments to write on Socket"); | 459 throw new ArgumentError("Invalid arguments to write on Socket"); |
| 460 } | 460 } |
| 461 if (isClosing || isClosed) return 0; | 461 if (isClosing || isClosed) return 0; |
| 462 if (bytes == 0) return 0; | 462 if (bytes == 0) return 0; |
| 463 _BufferAndStart bufferAndStart = | 463 _BufferAndStart bufferAndStart = |
| 464 _ensureFastAndSerializableByteData(buffer, offset, offset + bytes); | 464 _ensureFastAndSerializableByteData(buffer, offset, offset + bytes); |
| 465 var result = | 465 var result = |
| 466 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); | 466 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); |
| 467 if (result is OSError) { | 467 if (result is OSError) { |
| 468 reportError(result, "Write failed"); | 468 scheduleMicrotask(() => reportError(result, "Write failed")); |
| 469 result = 0; | 469 result = 0; |
| 470 } | 470 } |
| 471 return result; | 471 return result; |
| 472 } | 472 } |
| 473 | 473 |
| 474 _NativeSocket accept() { | 474 _NativeSocket accept() { |
| 475 // Don't issue accept if we're closing. | 475 // Don't issue accept if we're closing. |
| 476 if (isClosing || isClosed) return null; | 476 if (isClosing || isClosed) return null; |
| 477 var socket = new _NativeSocket.normal(); | 477 var socket = new _NativeSocket.normal(); |
| 478 if (nativeAccept(socket) != true) return null; | 478 if (nativeAccept(socket) != true) return null; |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 if (_detachReady != null) { | 1274 if (_detachReady != null) { |
| 1275 _detachReady.complete(null); | 1275 _detachReady.complete(null); |
| 1276 } else { | 1276 } else { |
| 1277 if (_raw != null) { | 1277 if (_raw != null) { |
| 1278 _raw.shutdown(SocketDirection.SEND); | 1278 _raw.shutdown(SocketDirection.SEND); |
| 1279 _disableWriteEvent(); | 1279 _disableWriteEvent(); |
| 1280 } | 1280 } |
| 1281 } | 1281 } |
| 1282 } | 1282 } |
| 1283 } | 1283 } |
| OLD | NEW |