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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 11434034: Improve error handling in HttpClient (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | sdk/lib/io/http_parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 787a547143d98f135a144f075bb9a893a3985f7f..5539f3adb92b29bf49eb70840d19d4d080c7c5ef 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -1487,18 +1487,19 @@ class _HttpClientConnection
}
void _onError(e) {
+ // Cancel any pending data in the HTTP parser.
+ _httpParser.cancel();
if (_socketConn != null) {
_client._closeSocketConnection(_socketConn);
}
- if (_onErrorCallback != null) {
+ // Report the error.
+ if (_response != null && _response._streamErrorHandler != null) {
+ _response._streamErrorHandler(e);
+ } else if (_onErrorCallback != null) {
_onErrorCallback(e);
} else {
throw e;
}
- // Propagate the error to the streams.
- if (_response != null && _response._streamErrorHandler != null) {
- _response._streamErrorHandler(e);
- }
}
void _onResponseReceived(int statusCode,
@@ -1767,8 +1768,8 @@ class _HttpClient implements HttpClient {
});
if (force) {
_activeSockets.forEach((_SocketConnection socketConn) {
- socketConn._socket.close();
socketConn._httpClientConnection._onClientShutdown();
+ socketConn._close();
});
}
if (_evictionTimer != null) _cancelEvictionTimer();
« no previous file with comments | « no previous file | sdk/lib/io/http_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698