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

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

Issue 11358116: Fix memory growth in simple http server. (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 | no next file » | 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 a141b4fa0fcc3f2f825458fcc1bec304545d00cb..0af8979116183deba7c7cfab6b392d96d84b3148 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -1399,7 +1399,7 @@ class _HttpConnection extends _HttpConnectionBase {
// Don't report errors when HTTP parser is in idle state. Clients
// can close the connection and cause a connection reset by peer
// error which is OK.
- if (e != null && onError != null && !_httpParser.isIdle) {
+ if (e != null && !_httpParser.isIdle) {
onError(e);
// Propagate the error to the streams.
if (_request != null && _request._streamErrorHandler != null) {
@@ -1413,23 +1413,23 @@ class _HttpConnection extends _HttpConnectionBase {
// If currently not processing any request close the socket when
// we are done writing the response.
if (_httpParser.isIdle) {
- _socket.outputStream.onClosed = () {
- _destroy();
- if (onClosed != null && e == null) {
- // Don't call onClosed if onError has been called.
+ if (e != null) {
+ onError(e);
+ } else {
+ _socket.outputStream.onClosed = () {
+ _destroy();
onClosed();
- }
- };
- // If the client closes and we are done writing the response
- // the connection should be closed.
- if (_response == null) _close();
- return;
- }
-
- // Processing a request.
- if (e == null) {
- // Indicate connection close to the HTTP parser.
- _httpParser.connectionClosed();
+ };
+ // If the client closes and we are done writing the response
+ // the connection should be closed.
+ if (_response == null) _close();
+ }
+ } else {
+ // Processing a request.
+ if (e == null) {
+ // Indicate connection close to the HTTP parser.
+ _httpParser.connectionClosed();
+ }
}
}
@@ -1473,6 +1473,7 @@ class _HttpConnection extends _HttpConnectionBase {
if (_closing) {
_socket.outputStream.onClosed = () {
_socket.close();
+ onClosed();
};
}
_response = null;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698