| 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 // Test socket close events. | 10 // Test socket close events. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 void dispatch(message, SendPort replyTo) { | 333 void dispatch(message, SendPort replyTo) { |
| 334 _donePort = replyTo; | 334 _donePort = replyTo; |
| 335 if (message != SERVERSHUTDOWN) { | 335 if (message != SERVERSHUTDOWN) { |
| 336 _readBytes = 0; | 336 _readBytes = 0; |
| 337 _errorEvents = 0; | 337 _errorEvents = 0; |
| 338 _dataEvents = 0; | 338 _dataEvents = 0; |
| 339 _closeEvents = 0; | 339 _closeEvents = 0; |
| 340 _iterations = 0; | 340 _iterations = 0; |
| 341 _mode = message; | 341 _mode = message; |
| 342 ServerSocket.bind().then((server) { | 342 ServerSocket.bind("127.0.0.1", 0).then((server) { |
| 343 _server = server; | 343 _server = server; |
| 344 _server.listen( | 344 _server.listen( |
| 345 (socket) { | 345 (socket) { |
| 346 var data = new ConnectionData(socket); | 346 var data = new ConnectionData(socket); |
| 347 connectionHandler(data); | 347 connectionHandler(data); |
| 348 }, | 348 }, |
| 349 onError: errorHandlerServer | 349 onError: errorHandlerServer |
| 350 ); | 350 ); |
| 351 replyTo.send(_server.port, null); | 351 replyTo.send(_server.port, null); |
| 352 }); | 352 }); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 378 var tests = 7; | 378 var tests = 7; |
| 379 var port = new ReceivePort(); | 379 var port = new ReceivePort(); |
| 380 var completed = 0; | 380 var completed = 0; |
| 381 port.receive((message, ignore) { | 381 port.receive((message, ignore) { |
| 382 if (++completed == tests) port.close(); | 382 if (++completed == tests) port.close(); |
| 383 }); | 383 }); |
| 384 for (var i = 0; i < tests; i++) { | 384 for (var i = 0; i < tests; i++) { |
| 385 new SocketClose.start(i, port.toSendPort()); | 385 new SocketClose.start(i, port.toSendPort()); |
| 386 } | 386 } |
| 387 } | 387 } |
| OLD | NEW |