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

Unified Diff: runtime/bin/vmservice/vmservice_io.dart

Issue 237113002: SIGQUIT toggles VM service HTTP server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« runtime/bin/vmservice/server.dart ('K') | « runtime/bin/vmservice/server.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/vmservice_io.dart
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 5101858b1aa83aeacf440e4046fafa9f199a129e..ea50d113f67a904d11f20dc2642286c32a9e2ec7 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -16,13 +16,30 @@ part 'server.dart';
// The TCP port that the HTTP server listens on.
int _port;
+// HTTP servr.
+Server server;
+
// The VM service instance.
VMService service;
+void _onSignal(ProcessSignal signal) {
Ivan Posva 2014/04/14 16:12:58 _onUSR1Signal or _onVMServiceSignal
Cutch 2014/04/15 17:42:07 Done.
+ // Toggle HTTP server.
+ if (server.running) {
+ server.shutdown();
+ } else {
+ server.startup();
+ }
+}
+
main() {
// Get VMService.
service = new VMService();
+ // Listen for SIGUSR1.
+ ProcessSignal.SIGUSR1.watch().listen(_onSignal);
turnidge 2014/04/14 16:51:46 If a signal is processed immediately at this point
Cutch 2014/04/15 17:42:07 dart:io signals aren't delivered like regular sign
// Start HTTP server.
- var server = new Server(service, _port);
- server.startServer();
+ server = new Server(service, _port);
+ if (_port != 0) {
+ // Port was specified, start HTTP server immediately.
+ server.startup();
+ }
}
« runtime/bin/vmservice/server.dart ('K') | « runtime/bin/vmservice/server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698