From: Florian Dold Date: Tue, 24 Sep 2019 16:21:53 +0000 (+0200) Subject: add stopping state X-Git-Tag: v0.11.7~105^2~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d07beeb5398659712e370a977ade6d9a27b84522;p=oweals%2Fgnunet.git add stopping state --- diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index fcbff2331..954d31cfb 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c @@ -561,20 +561,24 @@ list_callback(void *cls, fprintf(stdout, "%s (binary='%s', status=stopped)\n", list[i].name, list[i].binary); break; case GNUNET_ARM_SERVICE_STATUS_FAILED: - restart_in = GNUNET_TIME_absolute_get_remaining (list[i].restart_at); - fprintf(stdout, "%s (binary='%s', status=failed, exit_status=%d, restart_delay='%s')\n", - list[i].name, - list[i].binary, - list[i].last_exit_status, - GNUNET_STRINGS_relative_time_to_string (restart_in, GNUNET_YES)); - break; + restart_in = GNUNET_TIME_absolute_get_remaining (list[i].restart_at); + fprintf(stdout, "%s (binary='%s', status=failed, exit_status=%d, restart_delay='%s')\n", + list[i].name, + list[i].binary, + list[i].last_exit_status, + GNUNET_STRINGS_relative_time_to_string (restart_in, GNUNET_YES)); + break; case GNUNET_ARM_SERVICE_STATUS_FINISHED: - fprintf(stdout, "%s (binary='%s', status=finished)\n", list[i].name, list[i].binary); - break; + fprintf(stdout, "%s (binary='%s', status=finished)\n", list[i].name, list[i].binary); + break; case GNUNET_ARM_SERVICE_STATUS_STARTED: - fprintf(stdout, "%s (binary='%s', status=started)\n", list[i].name, list[i].binary); - break; + fprintf(stdout, "%s (binary='%s', status=started)\n", list[i].name, list[i].binary); + break; + case GNUNET_ARM_SERVICE_STATUS_STOPPING: + fprintf(stdout, "%s (binary='%s', status=stopping)\n", list[i].name, list[i].binary); + break; default: + GNUNET_break_op (0); fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, list[i].binary); break; diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index b30ae518e..65404bbed 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -1400,6 +1400,10 @@ handle_list(void *cls, const struct GNUNET_ARM_Message *request) ssm->last_exit_status = htons (sl->last_exit_status); } } + else if ((NULL != sl->killing_client) || (GNUNET_YES == in_shutdown)) + { + ssm->status = htonl (GNUNET_ARM_SERVICE_STATUS_STOPPING); + } else { ssm->status = htonl (GNUNET_ARM_SERVICE_STATUS_STARTED); diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h index 9e79c26e7..32355a3e5 100644 --- a/src/include/gnunet_arm_service.h +++ b/src/include/gnunet_arm_service.h @@ -174,6 +174,12 @@ enum GNUNET_ARM_ServiceStatus * The service was started, but then exited normally. */ GNUNET_ARM_SERVICE_STATUS_FINISHED = 3, + + /** + * The service was started, and we're currently waiting + * for it to be stopped. + */ + GNUNET_ARM_SERVICE_STATUS_STOPPING = 4, };