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

Unified Diff: runtime/bin/socket_impl.dart

Issue 8363044: Only call the dataReceived callback for sockets if there is actually data available (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_impl.dart
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_impl.dart
index d578d04bb1e85f83aa74f54f1262a69874cdb8bb..c8bcbaaa8c4839b8dddde6ad6a4b0b0e29c998e2 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -42,12 +42,14 @@ class _SocketBase {
for (int i = _FIRST_EVENT; i <= _LAST_EVENT; i++) {
if (((event_mask & (1 << i)) != 0) && _handlerMap[i] !== null) {
var handleEvent = _handlerMap[i];
- /*
- * Unregister the out handler before executing it.
- */
- if (i == _OUT_EVENT) {
- _setHandler(i, null);
- }
+
+ // Unregister the out handler before executing it.
+ if (i == _OUT_EVENT) _setHandler(i, null);
+
+ // Don't call the in handler if there is no data available
+ // after all.
+ if (i == _IN_EVENT && this is _Socket && available() == 0) continue;
+
handleEvent();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698