| 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 "dart:async"; | 10 import "dart:async"; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 closed++; | 116 closed++; |
| 117 // Wait for both server and client to see the connections as closed. | 117 // Wait for both server and client to see the connections as closed. |
| 118 if (closed == connections * 2) { | 118 if (closed == connections * 2) { |
| 119 Expect.equals(0, server.connectionsInfo().active); | 119 Expect.equals(0, server.connectionsInfo().active); |
| 120 Expect.equals(server.connectionsInfo().total, | 120 Expect.equals(server.connectionsInfo().total, |
| 121 server.connectionsInfo().idle); | 121 server.connectionsInfo().idle); |
| 122 server.close(); | 122 server.close(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 server.listen((request) { | 125 server.listen((request) { |
| 126 var timer = new Timer.repeating(const Duration(milliseconds: 20), (_) { | 126 var timer = new Timer.periodic(const Duration(milliseconds: 20), (_) { |
| 127 request.response.writeBytes(new Uint8List(16 * 1024)); | 127 request.response.writeBytes(new Uint8List(16 * 1024)); |
| 128 }); | 128 }); |
| 129 request.response.done | 129 request.response.done |
| 130 .catchError((_) {}) | 130 .catchError((_) {}) |
| 131 .whenComplete(() { | 131 .whenComplete(() { |
| 132 check(); | 132 check(); |
| 133 timer.cancel(); | 133 timer.cancel(); |
| 134 }); | 134 }); |
| 135 }); | 135 }); |
| 136 var client = new HttpClient(); | 136 var client = new HttpClient(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 void main() { | 154 void main() { |
| 155 testClientAndServerCloseNoListen(10); | 155 testClientAndServerCloseNoListen(10); |
| 156 testClientCloseServerListen(10); | 156 testClientCloseServerListen(10); |
| 157 testClientCloseDelayed(10); | 157 testClientCloseDelayed(10); |
| 158 testClientCloseSendingResponse(10); | 158 testClientCloseSendingResponse(10); |
| 159 } | 159 } |
| 160 | 160 |
| OLD | NEW |