Chromium Code Reviews| Index: runtime/bin/http_impl.dart |
| diff --git a/runtime/bin/http_impl.dart b/runtime/bin/http_impl.dart |
| index cbfa7de120b8703120c8fb553f22789d0b0744d2..34f893cfd41fe7cc32f96a180d731ce1d9375397 100644 |
| --- a/runtime/bin/http_impl.dart |
| +++ b/runtime/bin/http_impl.dart |
| @@ -690,7 +690,11 @@ class _HttpRequestResponseBase { |
| } |
| assert(_headResponse || _bodyBytesWritten == _contentLength); |
| } |
| - if (!persistentConnection) _httpConnection._close(); |
| + // If we are done writing the response and the client has closed |
| + // or the connection is not persistent we can close. |
| + if (!persistentConnection || _httpConnection._closing) { |
| + _httpConnection._close(); |
| + } |
| return allWritten; |
| } |
| @@ -1351,6 +1355,9 @@ class _HttpConnection extends _HttpConnectionBase { |
| // If currently not processing any request just close the socket. |
| if (_httpParser.isIdle) { |
| + // If the client closes and we are done writing the response |
| + // the connection should be closed. |
| + if (_response == null) _close(); |
|
Anders Johnsen
2012/09/11 12:49:40
Nice. Would it make sense to move this to below th
Mads Ager (google)
2012/09/11 14:43:11
I can do that. Thanks. :)
|
| _socket.outputStream.onClosed = () { |
| _destroy(); |
| if (onClosed != null && e == null) { |