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

Unified Diff: runtime/bin/socket_impl.dart

Issue 10052007: Socket.available should never return a negative value. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to use OSError. 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 | « runtime/bin/socket.cc ('k') | 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 3ca73bf729001b1b473e7a668f88ced3de10e11a..6621146e6621824851b8aa252611a26ebc198c10 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -347,13 +347,19 @@ class _Socket extends _SocketBase implements Socket {
int available() {
if (_id >= 0) {
- return _available();
+ var result = _available();
+ if (result is OSError) {
+ _reportError(result, "Available failed");
+ return 0;
+ } else {
+ return result;
+ }
}
throw new
SocketIOException("Error: available failed - invalid socket handle");
}
- int _available() native "Socket_Available";
+ _available() native "Socket_Available";
int readList(List<int> buffer, int offset, int bytes) {
if (_id >= 0) {
« no previous file with comments | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698