| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 throw new ArgumentError(direction); | 608 throw new ArgumentError(direction); |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 | 612 |
| 613 void shutdownWrite() { | 613 void shutdownWrite() { |
| 614 if (!isClosing && !isClosed) { | 614 if (!isClosing && !isClosed) { |
| 615 if (isClosedRead) { | 615 if (isClosedRead) { |
| 616 close(); | 616 close(); |
| 617 } else { | 617 } else { |
| 618 bool connected = eventPort != null; |
| 618 sendToEventHandler(1 << SHUTDOWN_WRITE_COMMAND); | 619 sendToEventHandler(1 << SHUTDOWN_WRITE_COMMAND); |
| 620 if (!connected) disconnectFromEventHandler(); |
| 619 } | 621 } |
| 620 isClosedWrite = true; | 622 isClosedWrite = true; |
| 621 } | 623 } |
| 622 } | 624 } |
| 623 | 625 |
| 624 void shutdownRead() { | 626 void shutdownRead() { |
| 625 if (!isClosing && !isClosed) { | 627 if (!isClosing && !isClosed) { |
| 626 if (isClosedWrite) { | 628 if (isClosedWrite) { |
| 627 close(); | 629 close(); |
| 628 } else { | 630 } else { |
| 631 bool connected = eventPort != null; |
| 629 sendToEventHandler(1 << SHUTDOWN_READ_COMMAND); | 632 sendToEventHandler(1 << SHUTDOWN_READ_COMMAND); |
| 633 if (!connected) disconnectFromEventHandler(); |
| 630 } | 634 } |
| 631 isClosedRead = true; | 635 isClosedRead = true; |
| 632 } | 636 } |
| 633 } | 637 } |
| 634 | 638 |
| 635 void sendToEventHandler(int data) { | 639 void sendToEventHandler(int data) { |
| 636 connectToEventHandler(); | 640 connectToEventHandler(); |
| 637 assert(!isClosed); | 641 assert(!isClosed); |
| 638 _EventHandler._sendData(this, eventPort, data); | 642 _EventHandler._sendData(this, eventPort, data); |
| 639 } | 643 } |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 if (_detachReady != null) { | 1272 if (_detachReady != null) { |
| 1269 _detachReady.complete(null); | 1273 _detachReady.complete(null); |
| 1270 } else { | 1274 } else { |
| 1271 if (_raw != null) { | 1275 if (_raw != null) { |
| 1272 _raw.shutdown(SocketDirection.SEND); | 1276 _raw.shutdown(SocketDirection.SEND); |
| 1273 _disableWriteEvent(); | 1277 _disableWriteEvent(); |
| 1274 } | 1278 } |
| 1275 } | 1279 } |
| 1276 } | 1280 } |
| 1277 } | 1281 } |
| OLD | NEW |