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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 sync: true, | 1197 sync: true, |
1198 onListen: _onSubscriptionStateChange, | 1198 onListen: _onSubscriptionStateChange, |
1199 onCancel: _onSubscriptionStateChange, | 1199 onCancel: _onSubscriptionStateChange, |
1200 onPause: _onPauseStateChange, | 1200 onPause: _onPauseStateChange, |
1201 onResume: _onPauseStateChange); | 1201 onResume: _onPauseStateChange); |
1202 _socket.setHandlers( | 1202 _socket.setHandlers( |
1203 read: () => _controller.add(RawSocketEvent.READ), | 1203 read: () => _controller.add(RawSocketEvent.READ), |
1204 write: () { | 1204 write: () { |
1205 // The write event handler is automatically disabled by the | 1205 // The write event handler is automatically disabled by the |
1206 // event handler when it fires. | 1206 // event handler when it fires. |
1207 _writeEventsEnabled = false; | 1207 writeEventsEnabled = false; |
1208 _controller.add(RawSocketEvent.WRITE); | 1208 _controller.add(RawSocketEvent.WRITE); |
1209 }, | 1209 }, |
1210 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), | 1210 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), |
1211 destroyed: () { | 1211 destroyed: () { |
1212 _controller.add(RawSocketEvent.CLOSED); | 1212 _controller.add(RawSocketEvent.CLOSED); |
1213 _controller.close(); | 1213 _controller.close(); |
1214 }, | 1214 }, |
1215 error: zone.bindUnaryCallback((e) { | 1215 error: zone.bindUnaryCallback((e) { |
1216 _controller.addError(e); | 1216 _controller.addError(e); |
1217 _socket.close(); | 1217 _socket.close(); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 sync: true, | 1693 sync: true, |
1694 onListen: _onSubscriptionStateChange, | 1694 onListen: _onSubscriptionStateChange, |
1695 onCancel: _onSubscriptionStateChange, | 1695 onCancel: _onSubscriptionStateChange, |
1696 onPause: _onPauseStateChange, | 1696 onPause: _onPauseStateChange, |
1697 onResume: _onPauseStateChange); | 1697 onResume: _onPauseStateChange); |
1698 _socket.setHandlers( | 1698 _socket.setHandlers( |
1699 read: () => _controller.add(RawSocketEvent.READ), | 1699 read: () => _controller.add(RawSocketEvent.READ), |
1700 write: () { | 1700 write: () { |
1701 // The write event handler is automatically disabled by the | 1701 // The write event handler is automatically disabled by the |
1702 // event handler when it fires. | 1702 // event handler when it fires. |
1703 _writeEventsEnabled = false; | 1703 writeEventsEnabled = false; |
1704 _controller.add(RawSocketEvent.WRITE); | 1704 _controller.add(RawSocketEvent.WRITE); |
1705 }, | 1705 }, |
1706 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), | 1706 closed: () => _controller.add(RawSocketEvent.READ_CLOSED), |
1707 destroyed: () { | 1707 destroyed: () { |
1708 _controller.add(RawSocketEvent.CLOSED); | 1708 _controller.add(RawSocketEvent.CLOSED); |
1709 _controller.close(); | 1709 _controller.close(); |
1710 }, | 1710 }, |
1711 error: zone.bindUnaryCallback((e) { | 1711 error: zone.bindUnaryCallback((e) { |
1712 _controller.addError(e); | 1712 _controller.addError(e); |
1713 _socket.close(); | 1713 _socket.close(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 } else { | 1803 } else { |
1804 _socket.close(); | 1804 _socket.close(); |
1805 } | 1805 } |
1806 } | 1806 } |
1807 } | 1807 } |
1808 | 1808 |
1809 Datagram _makeDatagram( | 1809 Datagram _makeDatagram( |
1810 List<int> data, String address, List<int> in_addr, int port) { | 1810 List<int> data, String address, List<int> in_addr, int port) { |
1811 return new Datagram(data, new _InternetAddress(address, null, in_addr), port); | 1811 return new Datagram(data, new _InternetAddress(address, null, in_addr), port); |
1812 } | 1812 } |
OLD | NEW |