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

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

Issue 15293002: Fix socket leak in HttpServer, when the connection is closed while receiving data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | 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 73acb00df7c2ac96fbe9abf6a14af856dafa9ded..b2d63b6a393a235fb017ba160bef1ed609b04a8e 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -47,9 +47,9 @@ class _HttpIncoming extends Stream<List<int>> {
// Is completed once all data have been received.
Future get dataDone => _dataCompleter.future;
- void close() {
+ void close(bool closing) {
fullBodyRead = true;
- _dataCompleter.complete();
+ _dataCompleter.complete(closing);
}
}
@@ -1668,6 +1668,10 @@ class _HttpConnection {
_socket.pipe(_httpParser);
_subscription = _httpParser.listen(
(incoming) {
+ // If the incoming was closed, close the connection.
+ incoming.dataDone.then((closing) {
+ if (closing) destroy();
+ });
// Only handle one incoming request at the time. Keep the
// stream paused until the request has been send.
_subscription.pause();
« 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