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

Unified Diff: runtime/bin/http_impl.dart

Issue 10356055: Make the HTTP server close non-persistent connections (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | tests/standalone/io/http_connection_close_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_impl.dart
diff --git a/runtime/bin/http_impl.dart b/runtime/bin/http_impl.dart
index 8b197d799f576be7125367487e528e59456cfe67..02b7764eee570fcb08bc864e26e0306f2c29f16b 100644
--- a/runtime/bin/http_impl.dart
+++ b/runtime/bin/http_impl.dart
@@ -317,6 +317,7 @@ class _HttpRequestResponseBase {
}
assert(_bodyBytesWritten == _contentLength);
}
+ if (!persistentConnection) _httpConnection._close();
return allWritten;
}
@@ -754,6 +755,11 @@ class _HttpConnectionBase implements Hashable {
bool _close() {
_closing = true;
+ _socket.outputStream.close();
+ }
+
+ bool _destroy() {
+ _closing = true;
_socket.close();
}
@@ -771,7 +777,7 @@ class _HttpConnectionBase implements Hashable {
if (parsed != bytesRead) {
if (_socket != null) {
// TODO(sgjesse): Error handling.
- _close();
+ _destroy();
}
}
}
@@ -863,7 +869,7 @@ class _HttpConnection extends _HttpConnectionBase {
// If currently not processing any request just close the socket.
if (_httpParser.isIdle) {
- _close();
+ _destroy();
if (onClosed != null && e == null) {
// Don't call onClosed if onError has been called.
onClosed();
« no previous file with comments | « no previous file | tests/standalone/io/http_connection_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698