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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 } | 1382 } |
1383 } | 1383 } |
1384 | 1384 |
1385 void _onSubscriptionStateChange() { | 1385 void _onSubscriptionStateChange() { |
1386 if (_controller.hasListener) { | 1386 if (_controller.hasListener) { |
1387 _resume(); | 1387 _resume(); |
1388 } else { | 1388 } else { |
1389 _socket.close(); | 1389 _socket.close(); |
1390 } | 1390 } |
1391 } | 1391 } |
| 1392 |
| 1393 Map _toJSON(bool ref) => _socket._toJSON(ref); |
1392 } | 1394 } |
1393 | 1395 |
1394 | 1396 |
1395 patch class ServerSocket { | 1397 patch class ServerSocket { |
1396 /* patch */ static Future<ServerSocket> bind(address, | 1398 /* patch */ static Future<ServerSocket> bind(address, |
1397 int port, | 1399 int port, |
1398 {int backlog: 0, | 1400 {int backlog: 0, |
1399 bool v6Only: false}) { | 1401 bool v6Only: false}) { |
1400 return _ServerSocket.bind(address, port, backlog, v6Only); | 1402 return _ServerSocket.bind(address, port, backlog, v6Only); |
1401 } | 1403 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 _controllerClosed = true; | 1629 _controllerClosed = true; |
1628 _controller.close(); | 1630 _controller.close(); |
1629 } | 1631 } |
1630 | 1632 |
1631 bool setOption(SocketOption option, bool enabled) { | 1633 bool setOption(SocketOption option, bool enabled) { |
1632 if (_raw == null) return false; | 1634 if (_raw == null) return false; |
1633 return _raw.setOption(option, enabled); | 1635 return _raw.setOption(option, enabled); |
1634 } | 1636 } |
1635 | 1637 |
1636 int get port => _raw.port; | 1638 int get port => _raw.port; |
| 1639 InternetAddress get address => _raw.address; |
| 1640 int get remotePort => _raw.remotePort; |
1637 InternetAddress get remoteAddress => _raw.remoteAddress; | 1641 InternetAddress get remoteAddress => _raw.remoteAddress; |
1638 int get remotePort => _raw.remotePort; | |
1639 | 1642 |
1640 Future _detachRaw() { | 1643 Future _detachRaw() { |
1641 _detachReady = new Completer(); | 1644 _detachReady = new Completer(); |
1642 _sink.close(); | 1645 _sink.close(); |
1643 return _detachReady.future.then((_) { | 1646 return _detachReady.future.then((_) { |
1644 assert(_consumer.buffer == null); | 1647 assert(_consumer.buffer == null); |
1645 var raw = _raw; | 1648 var raw = _raw; |
1646 _raw = null; | 1649 _raw = null; |
1647 return [raw, _subscription]; | 1650 return [raw, _subscription]; |
1648 }); | 1651 }); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 void _consumerDone() { | 1740 void _consumerDone() { |
1738 if (_detachReady != null) { | 1741 if (_detachReady != null) { |
1739 _detachReady.complete(null); | 1742 _detachReady.complete(null); |
1740 } else { | 1743 } else { |
1741 if (_raw != null) { | 1744 if (_raw != null) { |
1742 _raw.shutdown(SocketDirection.SEND); | 1745 _raw.shutdown(SocketDirection.SEND); |
1743 _disableWriteEvent(); | 1746 _disableWriteEvent(); |
1744 } | 1747 } |
1745 } | 1748 } |
1746 } | 1749 } |
| 1750 |
| 1751 Map _toJSON(bool ref) => _raw._toJSON(ref); |
1747 } | 1752 } |
1748 | 1753 |
1749 | 1754 |
1750 patch class RawDatagramSocket { | 1755 patch class RawDatagramSocket { |
1751 /* patch */ static Future<RawDatagramSocket> bind( | 1756 /* patch */ static Future<RawDatagramSocket> bind( |
1752 host, int port, {bool reuseAddress: true}) { | 1757 host, int port, {bool reuseAddress: true}) { |
1753 return _RawDatagramSocket.bind(host, port, reuseAddress); | 1758 return _RawDatagramSocket.bind(host, port, reuseAddress); |
1754 } | 1759 } |
1755 } | 1760 } |
1756 | 1761 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 String address, | 1897 String address, |
1893 List<int> in_addr, | 1898 List<int> in_addr, |
1894 int port) { | 1899 int port) { |
1895 return new Datagram( | 1900 return new Datagram( |
1896 data, | 1901 data, |
1897 new _InternetAddress(address, null, in_addr), | 1902 new _InternetAddress(address, null, in_addr), |
1898 port); | 1903 port); |
1899 } | 1904 } |
1900 | 1905 |
1901 String _socketsStats() => _SocketsObservatory.toJSON(); | 1906 String _socketsStats() => _SocketsObservatory.toJSON(); |
OLD | NEW |