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

Unified Diff: tests/standalone/io/http_close_test.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 | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_close_test.dart
diff --git a/tests/standalone/io/http_close_test.dart b/tests/standalone/io/http_close_test.dart
index a4f8175a2fb667af5938ee4b38f5418fcac2ba6c..17b4e47b7c449e32f05d57877b8a67a9f2ceb2dc 100644
--- a/tests/standalone/io/http_close_test.dart
+++ b/tests/standalone/io/http_close_test.dart
@@ -111,9 +111,36 @@ void testClientCloseSendingResponse(int connections) {
}
+void testClientCloseWhileSendingRequest(int connections) {
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ int errors = 0;
+ server.listen((request) {
+ request.listen((_) {}, onError: (e) { errors++; });
+ });
+ var client = new HttpClient();
+ for (int i = 0; i < connections; i++) {
+ client.post("127.0.0.1", server.port, "/")
+ .then((request) {
+ request.contentLength = 110;
+ request.write("0123456789");
+ return request.close();
+ })
+ .catchError((_) {});
+ }
+ new Timer.periodic(const Duration(milliseconds: 100), (t) {
+ if (errors == connections && server.connectionsInfo().total == 0) {
+ t.cancel();
+ server.close();
+ }
+ });
+ });
+}
+
+
void main() {
testClientAndServerCloseNoListen(10);
testClientCloseServerListen(10);
testClientCloseSendingResponse(10);
+ testClientCloseWhileSendingRequest(10);
}
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698