diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-10 19:36:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-10 19:36:31 +0000 |
commit | 71a7ffc12e0adf07336690eeed6e4a7bdfcf522d (patch) | |
tree | ee2d1172f6e1c0abf7fb8d724890535dfc266ff3 | |
parent | 30992599145ed7472194aaf1456dc7b881068275 (diff) | |
download | gnunet-gtk-71a7ffc12e0adf07336690eeed6e4a7bdfcf522d.tar.gz gnunet-gtk-71a7ffc12e0adf07336690eeed6e4a7bdfcf522d.zip |
-also start identity service if it is not yet running
-rw-r--r-- | src/setup/gnunet-setup.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c index 0b5c2634..6a4aee80 100644 --- a/src/setup/gnunet-setup.c +++ b/src/setup/gnunet-setup.c | |||
@@ -65,6 +65,11 @@ static struct GNUNET_OS_Process *resolver; | |||
65 | static struct GNUNET_OS_Process *namestore; | 65 | static struct GNUNET_OS_Process *namestore; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Identity process handle. | ||
69 | */ | ||
70 | static struct GNUNET_OS_Process *identity; | ||
71 | |||
72 | /** | ||
68 | * Run autoconfig-only and then exit immediately. | 73 | * Run autoconfig-only and then exit immediately. |
69 | */ | 74 | */ |
70 | static int do_autoconfig; | 75 | static int do_autoconfig; |
@@ -381,6 +386,12 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
381 | GNUNET_OS_process_destroy (namestore); | 386 | GNUNET_OS_process_destroy (namestore); |
382 | namestore = NULL; | 387 | namestore = NULL; |
383 | } | 388 | } |
389 | if (NULL != identity) | ||
390 | { | ||
391 | GNUNET_break (0 == GNUNET_OS_process_kill (identity, SIGTERM)); | ||
392 | GNUNET_OS_process_destroy (identity); | ||
393 | identity = NULL; | ||
394 | } | ||
384 | } | 395 | } |
385 | 396 | ||
386 | 397 | ||
@@ -450,6 +461,30 @@ start_resolver (void *cls, | |||
450 | 461 | ||
451 | 462 | ||
452 | /** | 463 | /** |
464 | * If the test failed, start the identity process. | ||
465 | * | ||
466 | * @param cls closure, NULL | ||
467 | * @param result #GNUNET_YES if the service is running | ||
468 | */ | ||
469 | static void | ||
470 | start_identity (void *cls, | ||
471 | int result) | ||
472 | { | ||
473 | char *binary; | ||
474 | |||
475 | if (GNUNET_YES == result) | ||
476 | return; | ||
477 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-identity"); | ||
478 | identity = | ||
479 | GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ALL, | ||
480 | NULL, NULL, | ||
481 | binary, | ||
482 | "gnunet-service-identity", NULL); | ||
483 | GNUNET_free (binary); | ||
484 | } | ||
485 | |||
486 | |||
487 | /** | ||
453 | * If the test failed, start the namestore process. | 488 | * If the test failed, start the namestore process. |
454 | * | 489 | * |
455 | * @param cls closure, NULL | 490 | * @param cls closure, NULL |
@@ -598,6 +633,10 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
598 | cfg, | 633 | cfg, |
599 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | 634 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, |
600 | &start_namestore, NULL); | 635 | &start_namestore, NULL); |
636 | GNUNET_CLIENT_service_test ("identity", | ||
637 | cfg, | ||
638 | GNUNET_CONSTANTS_SERVICE_TIMEOUT, | ||
639 | &start_identity, NULL); | ||
601 | load_options (); | 640 | load_options (); |
602 | GNUNET_SETUP_gns_init (); | 641 | GNUNET_SETUP_gns_init (); |
603 | #ifndef MINGW | 642 | #ifndef MINGW |