OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:isolate"); | 10 #import("dart:isolate"); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 void dispatch(message, SendPort replyTo) { | 123 void dispatch(message, SendPort replyTo) { |
124 if (message.isStart) { | 124 if (message.isStart) { |
125 _server = new HttpServer(); | 125 _server = new HttpServer(); |
126 try { | 126 try { |
127 _server.listen("127.0.0.1", 0); | 127 _server.listen("127.0.0.1", 0); |
128 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { | 128 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { |
129 _requestReceivedHandler(req, rsp); | 129 _requestReceivedHandler(req, rsp); |
130 }; | 130 }; |
131 replyTo.send(new TestServerStatus.started(_server.port), null); | 131 replyTo.send(new TestServerStatus.started(_server.port), null); |
132 } catch (var e) { | 132 } catch (e) { |
133 replyTo.send(new TestServerStatus.error(), null); | 133 replyTo.send(new TestServerStatus.error(), null); |
134 } | 134 } |
135 } else if (message.isStop) { | 135 } else if (message.isStop) { |
136 _server.close(); | 136 _server.close(); |
137 port.close(); | 137 port.close(); |
138 replyTo.send(new TestServerStatus.stopped(), null); | 138 replyTo.send(new TestServerStatus.stopped(), null); |
139 } else if (message.isChunkedEncoding) { | 139 } else if (message.isChunkedEncoding) { |
140 _chunkedEncoding = true; | 140 _chunkedEncoding = true; |
141 } | 141 } |
142 } | 142 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 testServerMain.start(); | 262 testServerMain.start(); |
263 } | 263 } |
264 | 264 |
265 void main() { | 265 void main() { |
266 testReadInto(true); | 266 testReadInto(true); |
267 testReadInto(false); | 267 testReadInto(false); |
268 testReadShort(true); | 268 testReadShort(true); |
269 testReadShort(false); | 269 testReadShort(false); |
270 } | 270 } |
OLD | NEW |