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 bool shared: false}) { | 10 bool shared: false}) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return _in_addr[0] >= 224 && _in_addr[0] < 240; | 137 return _in_addr[0] >= 224 && _in_addr[0] < 240; |
138 | 138 |
139 case InternetAddressType.IP_V6: | 139 case InternetAddressType.IP_V6: |
140 // Checking for ff00::/8. | 140 // Checking for ff00::/8. |
141 return _in_addr[0] == 0xFF; | 141 return _in_addr[0] == 0xFF; |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 Future<InternetAddress> reverse() => _NativeSocket.reverseLookup(this); | 145 Future<InternetAddress> reverse() => _NativeSocket.reverseLookup(this); |
146 | 146 |
147 _InternetAddress(String this.address, | 147 _InternetAddress(this.address, this._host, this._in_addr); |
148 String this._host, | |
149 List<int> this._in_addr); | |
150 | 148 |
151 factory _InternetAddress.parse(String address) { | 149 factory _InternetAddress.parse(String address) { |
152 if (address is !String) { | 150 if (address is !String) { |
153 throw new ArgumentError("Invalid internet address $address"); | 151 throw new ArgumentError("Invalid internet address $address"); |
154 } | 152 } |
155 var in_addr = _parse(address); | 153 var in_addr = _parse(address); |
156 if (in_addr == null) { | 154 if (in_addr == null) { |
157 throw new ArgumentError("Invalid internet address $address"); | 155 throw new ArgumentError("Invalid internet address $address"); |
158 } | 156 } |
159 return new _InternetAddress(address, null, in_addr); | 157 return new _InternetAddress(address, null, in_addr); |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 class _Socket extends Stream<List<int>> implements Socket { | 1518 class _Socket extends Stream<List<int>> implements Socket { |
1521 RawSocket _raw; // Set to null when the raw socket is closed. | 1519 RawSocket _raw; // Set to null when the raw socket is closed. |
1522 bool _closed = false; // Set to true when the raw socket is closed. | 1520 bool _closed = false; // Set to true when the raw socket is closed. |
1523 StreamController _controller; | 1521 StreamController _controller; |
1524 bool _controllerClosed = false; | 1522 bool _controllerClosed = false; |
1525 _SocketStreamConsumer _consumer; | 1523 _SocketStreamConsumer _consumer; |
1526 IOSink _sink; | 1524 IOSink _sink; |
1527 var _subscription; | 1525 var _subscription; |
1528 var _detachReady; | 1526 var _detachReady; |
1529 | 1527 |
1530 _Socket(RawSocket this._raw) { | 1528 _Socket(this._raw) { |
1531 _controller = new StreamController<List<int>>(sync: true, | 1529 _controller = new StreamController<List<int>>(sync: true, |
1532 onListen: _onSubscriptionStateChange, | 1530 onListen: _onSubscriptionStateChange, |
1533 onCancel: _onSubscriptionStateChange, | 1531 onCancel: _onSubscriptionStateChange, |
1534 onPause: _onPauseStateChange, | 1532 onPause: _onPauseStateChange, |
1535 onResume: _onPauseStateChange); | 1533 onResume: _onPauseStateChange); |
1536 _consumer = new _SocketStreamConsumer(this); | 1534 _consumer = new _SocketStreamConsumer(this); |
1537 _sink = new IOSink(_consumer); | 1535 _sink = new IOSink(_consumer); |
1538 | 1536 |
1539 // Disable read events until there is a subscription. | 1537 // Disable read events until there is a subscription. |
1540 _raw.readEventsEnabled = false; | 1538 _raw.readEventsEnabled = false; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 Datagram _makeDatagram(List<int> data, | 1877 Datagram _makeDatagram(List<int> data, |
1880 String address, | 1878 String address, |
1881 List<int> in_addr, | 1879 List<int> in_addr, |
1882 int port) { | 1880 int port) { |
1883 return new Datagram( | 1881 return new Datagram( |
1884 data, | 1882 data, |
1885 new _InternetAddress(address, null, in_addr), | 1883 new _InternetAddress(address, null, in_addr), |
1886 port); | 1884 port); |
1887 } | 1885 } |
1888 | 1886 |
OLD | NEW |