| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 var result = | 419 var result = |
| 420 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); | 420 nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes); |
| 421 if (result is OSError) { | 421 if (result is OSError) { |
| 422 reportError(result, "Write failed"); | 422 reportError(result, "Write failed"); |
| 423 result = 0; | 423 result = 0; |
| 424 } | 424 } |
| 425 return result; | 425 return result; |
| 426 } | 426 } |
| 427 | 427 |
| 428 _NativeSocket accept() { | 428 _NativeSocket accept() { |
| 429 // Don't issue accept if we're closing. |
| 430 if (isClosing || isClosed) return null; |
| 429 var socket = new _NativeSocket.normal(); | 431 var socket = new _NativeSocket.normal(); |
| 430 if (nativeAccept(socket) != true) return null; | 432 if (nativeAccept(socket) != true) return null; |
| 431 socket.localPort = localPort; | 433 socket.localPort = localPort; |
| 432 socket.address = address; | 434 socket.address = address; |
| 433 return socket; | 435 return socket; |
| 434 } | 436 } |
| 435 | 437 |
| 436 int get port { | 438 int get port { |
| 437 if (localPort != null) return localPort; | 439 if (localPort != null) return localPort; |
| 438 return localPort = nativeGetPort(); | 440 return localPort = nativeGetPort(); |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 if (_detachReady != null) { | 1218 if (_detachReady != null) { |
| 1217 _detachReady.complete(null); | 1219 _detachReady.complete(null); |
| 1218 } else { | 1220 } else { |
| 1219 if (_raw != null) { | 1221 if (_raw != null) { |
| 1220 _raw.shutdown(SocketDirection.SEND); | 1222 _raw.shutdown(SocketDirection.SEND); |
| 1221 _disableWriteEvent(); | 1223 _disableWriteEvent(); |
| 1222 } | 1224 } |
| 1223 } | 1225 } |
| 1224 } | 1226 } |
| 1225 } | 1227 } |
| OLD | NEW |