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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 port.close(); | 281 port.close(); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 // Subscribe the server socket. Then cancel subscription and | 285 // Subscribe the server socket. Then cancel subscription and |
286 // subscribe again. | 286 // subscribe again. |
287 var subscription; | 287 var subscription; |
288 subscription = server.listen((client) { | 288 subscription = server.listen((client) { |
289 if (++acceptCount == socketCount / 2) { | 289 if (++acceptCount == socketCount / 2) { |
290 subscription.cancel(); | 290 subscription.cancel(); |
291 new Timer(0, (_) { | 291 Timer.run(() { |
292 subscription = server.listen((_) { | 292 subscription = server.listen((_) { |
293 // Close on cancel, so no more events. | 293 // Close on cancel, so no more events. |
294 Expect.fail("Event after closed through cancel"); | 294 Expect.fail("Event after closed through cancel"); |
295 }); | 295 }); |
296 }); | 296 }); |
297 } | 297 } |
298 // Close the client socket. | 298 // Close the client socket. |
299 client.close(); | 299 client.close(); |
300 }); | 300 }); |
301 | 301 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 testCloseOneEnd("client"); | 403 testCloseOneEnd("client"); |
404 testCloseOneEnd("server"); | 404 testCloseOneEnd("server"); |
405 testInvalidBind(); | 405 testInvalidBind(); |
406 testSimpleConnect(); | 406 testSimpleConnect(); |
407 testServerListenAfterConnect(); | 407 testServerListenAfterConnect(); |
408 testSimpleReadWrite(); | 408 testSimpleReadWrite(); |
409 testPauseServerSocket(); | 409 testPauseServerSocket(); |
410 testCancelResubscribeServerSocket(); | 410 testCancelResubscribeServerSocket(); |
411 testPauseSocket(); | 411 testPauseSocket(); |
412 } | 412 } |
OLD | NEW |