Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: runtime/bin/vmservice/server.dart

Issue 867113003: Revert r43217, r43215, r43208, r43207, and r43202. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/vmservice/resources.dart ('k') | runtime/bin/vmservice/vmservice_io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of vmservice_io; 5 part of vmservice_io;
6 6
7 class WebSocketClient extends Client { 7 class WebSocketClient extends Client {
8 static const int PARSE_ERROR_CODE = 4000; 8 static const int PARSE_ERROR_CODE = 4000;
9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001;
10 static const int NOT_MAP_ERROR_CODE = 4002; 10 static const int NOT_MAP_ERROR_CODE = 4002;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 Future startup() { 158 Future startup() {
159 if (_server != null) { 159 if (_server != null) {
160 // Already running. 160 // Already running.
161 return new Future.value(this); 161 return new Future.value(this);
162 } 162 }
163 163
164 // Startup HTTP server. 164 // Startup HTTP server.
165 return HttpServer.bind(_ip, _port).then((s) { 165 return HttpServer.bind(_ip, _port).then((s) {
166 _server = s; 166 _server = s;
167 _server.listen(_requestHandler); 167 _server.listen(_requestHandler);
168 var ip = _server.address.address.toString();
169 if (_displayMessages) { 168 if (_displayMessages) {
169 var ip = _server.address.address.toString();
170 var port = _server.port.toString(); 170 var port = _server.port.toString();
171 print('Observatory listening on http://$ip:$port'); 171 print('Observatory listening on http://$ip:$port');
172 } 172 }
173 // Server is up and running. 173 // Server is up and running.
174 _notifyServerState(ip, _server.port);
175 return this; 174 return this;
176 }).catchError((e, st) { 175 }).catchError((e, st) {
177 print('Could not start Observatory HTTP server:\n$e\n$st\n'); 176 print('Could not start Observatory HTTP server:\n$e\n$st\n');
178 _notifyServerState("", 0);
179 return this; 177 return this;
180 }); 178 });
181 } 179 }
182 180
183 Future shutdown(bool forced) { 181 Future shutdown(bool forced) {
184 if (_server == null) { 182 if (_server == null) {
185 // Not started. 183 // Not started.
186 return new Future.value(this); 184 return new Future.value(this);
187 } 185 }
188 186
189 // Force displaying of status messages if we are forcibly shutdown. 187 // Force displaying of status messages if we are forcibly shutdown.
190 _displayMessages = _displayMessages || forced; 188 _displayMessages = _displayMessages || forced;
191 189
192 // Shutdown HTTP server and subscription. 190 // Shutdown HTTP server and subscription.
193 var ip = _server.address.address.toString(); 191 var ip = _server.address.address.toString();
194 var port = _server.port.toString(); 192 var port = _server.port.toString();
195 return _server.close(force: forced).then((_) { 193 return _server.close(force: forced).then((_) {
196 if (_displayMessages) { 194 if (_displayMessages) {
197 print('Observatory no longer listening on http://$ip:$port'); 195 print('Observatory no longer listening on http://$ip:$port');
198 } 196 }
199 _server = null; 197 _server = null;
200 _notifyServerState("", 0);
201 return this; 198 return this;
202 }).catchError((e, st) { 199 }).catchError((e, st) {
203 _server = null; 200 _server = null;
204 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); 201 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
205 _notifyServerState("", 0);
206 return this; 202 return this;
207 }); 203 });
208 } 204 }
209 205
210 } 206 }
211
212 void _notifyServerState(String ip, int port)
213 native "VMServiceIO_NotifyServerState";
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/resources.dart ('k') | runtime/bin/vmservice/vmservice_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698