Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 569173003: Fix datagram issue where available is not correctly updated upon receive. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix CR Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/io/raw_datagram_read_all_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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();
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/raw_datagram_read_all_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698