diff options
Diffstat (limited to 'src/arm/gnunet-service-arm.c')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index ab96906a7..59f48a58c 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -344,7 +344,8 @@ free_entry (struct ServiceList *pos) | |||
344 | * @param sl identifies service to start | 344 | * @param sl identifies service to start |
345 | */ | 345 | */ |
346 | static void | 346 | static void |
347 | start_process (struct ServiceList *sl) | 347 | start_process (struct ServiceList *sl, |
348 | const int *lsocks) | ||
348 | { | 349 | { |
349 | char *loprefix; | 350 | char *loprefix; |
350 | char *options; | 351 | char *options; |
@@ -415,14 +416,16 @@ start_process (struct ServiceList *sl) | |||
415 | sl->name, sl->binary, sl->config); | 416 | sl->name, sl->binary, sl->config); |
416 | #endif | 417 | #endif |
417 | if (GNUNET_YES == use_debug) | 418 | if (GNUNET_YES == use_debug) |
418 | sl->pid = do_start_process (loprefix, | 419 | sl->pid = do_start_process (lsocks, |
420 | loprefix, | ||
419 | sl->binary, | 421 | sl->binary, |
420 | "-c", sl->config, | 422 | "-c", sl->config, |
421 | "-L", "DEBUG", | 423 | "-L", "DEBUG", |
422 | options, | 424 | options, |
423 | NULL); | 425 | NULL); |
424 | else | 426 | else |
425 | sl->pid = do_start_process (loprefix, | 427 | sl->pid = do_start_process (lsocks, |
428 | loprefix, | ||
426 | sl->binary, | 429 | sl->binary, |
427 | "-c", sl->config, | 430 | "-c", sl->config, |
428 | options, | 431 | options, |
@@ -442,9 +445,13 @@ start_process (struct ServiceList *sl) | |||
442 | * | 445 | * |
443 | * @param client who is asking for this | 446 | * @param client who is asking for this |
444 | * @param servicename name of the service to start | 447 | * @param servicename name of the service to start |
448 | * @param lsocks -1 terminated list of listen sockets to pass (systemd style), or NULL | ||
449 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
445 | */ | 450 | */ |
446 | void | 451 | int |
447 | start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | 452 | start_service (struct GNUNET_SERVER_Client *client, |
453 | const char *servicename, | ||
454 | const int *lsocks) | ||
448 | { | 455 | { |
449 | struct ServiceList *sl; | 456 | struct ServiceList *sl; |
450 | char *binary; | 457 | char *binary; |
@@ -457,7 +464,7 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | |||
457 | _("ARM is shutting down, service `%s' not started.\n"), | 464 | _("ARM is shutting down, service `%s' not started.\n"), |
458 | servicename); | 465 | servicename); |
459 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); | 466 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); |
460 | return; | 467 | return GNUNET_SYSERR; |
461 | } | 468 | } |
462 | sl = find_name (servicename); | 469 | sl = find_name (servicename); |
463 | if (sl != NULL) | 470 | if (sl != NULL) |
@@ -467,7 +474,7 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | |||
467 | sl->next = running; | 474 | sl->next = running; |
468 | running = sl; | 475 | running = sl; |
469 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); | 476 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); |
470 | return; | 477 | return GNUNET_SYSERR; |
471 | } | 478 | } |
472 | if (GNUNET_OK != | 479 | if (GNUNET_OK != |
473 | GNUNET_CONFIGURATION_get_value_string (cfg, | 480 | GNUNET_CONFIGURATION_get_value_string (cfg, |
@@ -477,7 +484,7 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | |||
477 | _("Binary implementing service `%s' not known!\n"), | 484 | _("Binary implementing service `%s' not known!\n"), |
478 | servicename); | 485 | servicename); |
479 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); | 486 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); |
480 | return; | 487 | return GNUNET_SYSERR; |
481 | } | 488 | } |
482 | if ((GNUNET_OK != | 489 | if ((GNUNET_OK != |
483 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 490 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
@@ -492,7 +499,7 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | |||
492 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); | 499 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_DOWN); |
493 | GNUNET_free (binary); | 500 | GNUNET_free (binary); |
494 | GNUNET_free_non_null (config); | 501 | GNUNET_free_non_null (config); |
495 | return; | 502 | return GNUNET_SYSERR; |
496 | } | 503 | } |
497 | (void) stop_listening (servicename); | 504 | (void) stop_listening (servicename); |
498 | sl = GNUNET_malloc (sizeof (struct ServiceList)); | 505 | sl = GNUNET_malloc (sizeof (struct ServiceList)); |
@@ -505,9 +512,10 @@ start_service (struct GNUNET_SERVER_Client *client, const char *servicename) | |||
505 | sl->restartAt = GNUNET_TIME_UNIT_FOREVER_ABS; | 512 | sl->restartAt = GNUNET_TIME_UNIT_FOREVER_ABS; |
506 | 513 | ||
507 | running = sl; | 514 | running = sl; |
508 | start_process (sl); | 515 | start_process (sl, lsocks); |
509 | if (NULL != client) | 516 | if (NULL != client) |
510 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); | 517 | signal_result (client, servicename, GNUNET_MESSAGE_TYPE_ARM_IS_UP); |
518 | return GNUNET_OK; | ||
511 | } | 519 | } |
512 | 520 | ||
513 | 521 | ||
@@ -610,7 +618,7 @@ handle_start (void *cls, | |||
610 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 618 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
611 | return; | 619 | return; |
612 | } | 620 | } |
613 | start_service (client, servicename); | 621 | start_service (client, servicename, NULL); |
614 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 622 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
615 | } | 623 | } |
616 | 624 | ||
@@ -776,7 +784,7 @@ delayed_restart_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
776 | { | 784 | { |
777 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 785 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
778 | _("Restarting service `%s'.\n"), pos->name); | 786 | _("Restarting service `%s'.\n"), pos->name); |
779 | start_process (pos); | 787 | start_process (pos, NULL); |
780 | } | 788 | } |
781 | else | 789 | else |
782 | { | 790 | { |
@@ -1071,7 +1079,7 @@ run (void *cls, | |||
1071 | pos = strtok (defaultservices, " "); | 1079 | pos = strtok (defaultservices, " "); |
1072 | while (pos != NULL) | 1080 | while (pos != NULL) |
1073 | { | 1081 | { |
1074 | start_service (NULL, pos); | 1082 | start_service (NULL, pos, NULL); |
1075 | pos = strtok (NULL, " "); | 1083 | pos = strtok (NULL, " "); |
1076 | } | 1084 | } |
1077 | } | 1085 | } |