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 | 5 @patch |
6 class RawServerSocket { | 6 class RawServerSocket { |
7 @patch | 7 @patch |
8 static Future<RawServerSocket> bind(address, int port, | 8 static Future<RawServerSocket> bind(address, int port, |
9 {int backlog: 0, bool v6Only: false, bool shared: false}) { | 9 {int backlog: 0, bool v6Only: false, bool shared: false}) { |
10 return _RawServerSocket.bind(address, port, backlog, v6Only, shared); | 10 return _RawServerSocket.bind(address, port, backlog, v6Only, shared); |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 sync: true, | 1222 sync: true, |
1223 onListen: _onSubscriptionStateChange, | 1223 onListen: _onSubscriptionStateChange, |
1224 onCancel: _onSubscriptionStateChange, | 1224 onCancel: _onSubscriptionStateChange, |
1225 onPause: _onPauseStateChange, | 1225 onPause: _onPauseStateChange, |
1226 onResume: _onPauseStateChange); | 1226 onResume: _onPauseStateChange); |
1227 _socket.setHandlers( | 1227 _socket.setHandlers( |
1228 read: () => _controller.add(RawSocketEvent.READ), | 1228 read: () => _controller.add(RawSocketEvent.READ), |
1229 write: () { | 1229 write: () { |
1230 // The write event handler is automatically disabled by the | 1230 // The write event handler is automatically disabled by the |
1231 // event handler when it fires. | 1231 // event handler when it fires. |
1232 _writeEventsEnabled = false; | 1232 writeEventsEnabled = false; |
1233 _controller.add(RawSocketEvent.WRITE); | 1233 _controller.add(RawSocketEvent.WRITE); |
1234 }, | 1234 }, |
1235 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), | 1235 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), |
1236 destroyed: () { | 1236 destroyed: () { |
1237 _controller.add(RawSocketEvent.CLOSED); | 1237 _controller.add(RawSocketEvent.CLOSED); |
1238 _controller.close(); | 1238 _controller.close(); |
1239 }, | 1239 }, |
1240 error: zone.bindUnaryCallback((e) { | 1240 error: zone.bindUnaryCallback((e) { |
1241 _controller.addError(e); | 1241 _controller.addError(e); |
1242 _socket.close(); | 1242 _socket.close(); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 sync: true, | 1719 sync: true, |
1720 onListen: _onSubscriptionStateChange, | 1720 onListen: _onSubscriptionStateChange, |
1721 onCancel: _onSubscriptionStateChange, | 1721 onCancel: _onSubscriptionStateChange, |
1722 onPause: _onPauseStateChange, | 1722 onPause: _onPauseStateChange, |
1723 onResume: _onPauseStateChange); | 1723 onResume: _onPauseStateChange); |
1724 _socket.setHandlers( | 1724 _socket.setHandlers( |
1725 read: () => _controller.add(RawSocketEvent.READ), | 1725 read: () => _controller.add(RawSocketEvent.READ), |
1726 write: () { | 1726 write: () { |
1727 // The write event handler is automatically disabled by the | 1727 // The write event handler is automatically disabled by the |
1728 // event handler when it fires. | 1728 // event handler when it fires. |
1729 _writeEventsEnabled = false; | 1729 writeEventsEnabled = false; |
1730 _controller.add(RawSocketEvent.WRITE); | 1730 _controller.add(RawSocketEvent.WRITE); |
1731 }, | 1731 }, |
1732 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), | 1732 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), |
1733 destroyed: () { | 1733 destroyed: () { |
1734 _controller.add(RawSocketEvent.CLOSED); | 1734 _controller.add(RawSocketEvent.CLOSED); |
1735 _controller.close(); | 1735 _controller.close(); |
1736 }, | 1736 }, |
1737 error: zone.bindUnaryCallback((e) { | 1737 error: zone.bindUnaryCallback((e) { |
1738 _controller.addError(e); | 1738 _controller.addError(e); |
1739 _socket.close(); | 1739 _socket.close(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 } else { | 1829 } else { |
1830 _socket.close(); | 1830 _socket.close(); |
1831 } | 1831 } |
1832 } | 1832 } |
1833 } | 1833 } |
1834 | 1834 |
1835 Datagram _makeDatagram( | 1835 Datagram _makeDatagram( |
1836 List<int> data, String address, List<int> in_addr, int port) { | 1836 List<int> data, String address, List<int> in_addr, int port) { |
1837 return new Datagram(data, new _InternetAddress(address, null, in_addr), port); | 1837 return new Datagram(data, new _InternetAddress(address, null, in_addr), port); |
1838 } | 1838 } |
OLD | NEW |