| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // VMOptions= | 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 Future.wait(futures).then((_) => server.close()); | 53 Future.wait(futures).then((_) => server.close()); |
| 54 }); | 54 }); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void testDeadlineAndDetach(int connections) { | 57 void testDeadlineAndDetach(int connections) { |
| 58 HttpServer.bind('localhost', 0).then((server) { | 58 HttpServer.bind('localhost', 0).then((server) { |
| 59 server.listen((request) { | 59 server.listen((request) { |
| 60 request.response.deadline = const Duration(milliseconds: 0); | 60 request.response.deadline = const Duration(milliseconds: 0); |
| 61 request.response.contentLength = 5; | 61 request.response.contentLength = 5; |
| 62 request.response.persistentConnection = false; |
| 62 request.response.detachSocket().then((socket) { | 63 request.response.detachSocket().then((socket) { |
| 63 new Timer(const Duration(milliseconds: 100), () { | 64 new Timer(const Duration(milliseconds: 100), () { |
| 64 socket.write('stuff'); | 65 socket.write('stuff'); |
| 65 socket.close(); | 66 socket.close(); |
| 66 socket.listen(null); | 67 socket.listen(null); |
| 67 }); | 68 }); |
| 68 }); | 69 }); |
| 69 }); | 70 }); |
| 70 | 71 |
| 71 var futures = []; | 72 var futures = []; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 84 Future.wait(futures).then((_) => server.close()); | 85 Future.wait(futures).then((_) => server.close()); |
| 85 }); | 86 }); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void main() { | 89 void main() { |
| 89 testSimpleDeadline(10); | 90 testSimpleDeadline(10); |
| 90 testExceedDeadline(10); | 91 testExceedDeadline(10); |
| 91 testDeadlineAndDetach(10); | 92 testDeadlineAndDetach(10); |
| 92 } | 93 } |
| 93 | 94 |
| OLD | NEW |