Chromium Code Reviews| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 560 return result; | 560 return result; |
| 561 } | 561 } |
| 562 | 562 |
| 563 Datagram receive() { | 563 Datagram receive() { |
| 564 if (isClosing || isClosed) return null; | 564 if (isClosing || isClosed) return null; |
| 565 var result = nativeRecvFrom(); | 565 var result = nativeRecvFrom(); |
| 566 if (result is OSError) { | 566 if (result is OSError) { |
| 567 reportError(result, "Receive failed"); | 567 reportError(result, "Receive failed"); |
| 568 return null; | 568 return null; |
| 569 } | 569 } |
| 570 if (result != null) { | 570 if (result != null) { |
|
Søren Gjesse
2014/09/15 08:20:32
Please add a comment that available is only the si
Anders Johnsen
2014/09/15 08:21:37
Done.
| |
| 571 if (Platform.isMacOS) { | 571 available = nativeAvailable(); |
| 572 // Mac includes the header size, so we need to query the actual | |
| 573 // available. | |
| 574 available = nativeAvailable(); | |
| 575 } else { | |
| 576 available -= result.data.length; | |
| 577 } | |
| 578 totalRead += result.data.length; | 572 totalRead += result.data.length; |
| 579 } | 573 } |
| 580 readCount++; | 574 readCount++; |
| 581 lastRead = timestamp; | 575 lastRead = timestamp; |
| 582 return result; | 576 return result; |
| 583 } | 577 } |
| 584 | 578 |
| 585 int write(List<int> buffer, int offset, int bytes) { | 579 int write(List<int> buffer, int offset, int bytes) { |
| 586 if (buffer is! List) throw new ArgumentError(); | 580 if (buffer is! List) throw new ArgumentError(); |
| 587 if (offset == null) offset = 0; | 581 if (offset == null) offset = 0; |
| (...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1929 String address, | 1923 String address, |
| 1930 List<int> in_addr, | 1924 List<int> in_addr, |
| 1931 int port) { | 1925 int port) { |
| 1932 return new Datagram( | 1926 return new Datagram( |
| 1933 data, | 1927 data, |
| 1934 new _InternetAddress(address, null, in_addr), | 1928 new _InternetAddress(address, null, in_addr), |
| 1935 port); | 1929 port); |
| 1936 } | 1930 } |
| 1937 | 1931 |
| 1938 String _socketsStats() => _SocketsObservatory.toJSON(); | 1932 String _socketsStats() => _SocketsObservatory.toJSON(); |
| OLD | NEW |