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

Unified 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: Comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/raw_datagram_read_all_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 23e3f9e200269a9b5423cf64a983c5330fc1af31..d598e273825b799e08ea8fed332508482b1d43c3 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -568,13 +568,11 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
return null;
}
if (result != null) {
- if (Platform.isMacOS) {
- // Mac includes the header size, so we need to query the actual
- // available.
- available = nativeAvailable();
- } else {
- available -= result.data.length;
- }
+ // Read the next available. Available is only for the next datagram, not
+ // the sum of all datagrams pending, so we need to call after each
+ // receive. If available becomes > 0, the _NativeSocket will continue to
+ // emit read events.
+ available = nativeAvailable();
totalRead += result.data.length;
}
readCount++;
« 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