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

Unified Diff: runtime/bin/http_impl.dart

Issue 9700012: Close connections on server.close(), and call onError on early connection close. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/http_impl.dart
===================================================================
--- runtime/bin/http_impl.dart (revision 5451)
+++ runtime/bin/http_impl.dart (working copy)
@@ -626,7 +626,13 @@
_server.onConnection = onConnection;
}
- void close() => _server.close();
+ void close() {
+ _server.close();
+ for (_HttpConnection connection in _connections) {
+ connection._socket.close();
+ }
+ }
+
int get port() => _server.port;
void set onError(void handler(String errorMessage)) {
@@ -887,6 +893,7 @@
_httpParser.headersComplete = () => _onHeadersComplete();
_httpParser.dataReceived = (data) => _onDataReceived(data);
_httpParser.dataEnd = () => _onDataEnd();
+ onDisconnect = _onDisconnected;
}
HttpClientRequest open(String method, String uri) {
@@ -917,6 +924,7 @@
}
void _onDataEnd() {
+ onDisconnect = null;
if (_response.headers["connection"] == "close") {
_socket.close();
} else {
@@ -935,6 +943,14 @@
_onResponse = handler;
}
+ void _onDisconnected() {
Søren Gjesse 2012/03/14 09:26:59 We probably need to handle this slightly different
Anders Johnsen 2012/03/14 09:34:43 My initial understanding was that _onDataEnd was c
Søren Gjesse 2012/03/14 10:03:30 You are right this should be fixed in the HTTP par
Anders Johnsen 2012/03/14 10:08:54 Want me to make it a part of this cl, or is it som
+ if (_onErrorCallback !== null) {
+ _onErrorCallback(
+ new HttpException("Client disconnected before response was sent."));
Søren Gjesse 2012/03/14 09:26:59 "was sent" should probably be "was received".
Anders Johnsen 2012/03/14 09:34:43 Done.
+ }
+ }
+
+
Function _onRequest;
Function _onResponse;
« 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