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

Unified Diff: runtime/bin/socket.cc

Issue 10052007: Socket.available should never return a negative value. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 9507613333ce2575e06e31dd206e63d9cef59be7..cdc2dd684bbb67d4a3d5c6a139e626ac5fba46da 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -39,6 +39,8 @@ void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) {
int64_t socket = DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
DartUtils::kIdFieldName);
intptr_t available = Socket::Available(socket);
+ // TODO(ajohnsen): Consider if we need to queue a calblack for onError.
+ if (available < 0) available = 0;
Mads Ager (google) 2012/04/11 07:20:23 I think we need to handle this differently. An err
Anders Johnsen 2012/04/11 07:25:06 Agreed, this is a lot better. I've updated as sugg
Dart_SetReturnValue(args, Dart_NewInteger(available));
Dart_ExitScope();
}
« 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