add stopping state
authorFlorian Dold <florian.dold@gmail.com>
Tue, 24 Sep 2019 16:21:53 +0000 (18:21 +0200)
committerFlorian Dold <florian.dold@gmail.com>
Tue, 24 Sep 2019 16:21:53 +0000 (18:21 +0200)
src/arm/gnunet-arm.c
src/arm/gnunet-service-arm.c
src/include/gnunet_arm_service.h

index fcbff2331af99ec073d8849576074276a8cd9280..954d31cfbdbca2989b89b65e8d4c394cd9da9b64 100644 (file)
@@ -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;
 
index b30ae518e9d788d05b65acfb12583728ff5eaae0..65404bbed1fa731e43299b16be104b4604cc7e2d 100644 (file)
@@ -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);
index 9e79c26e7ac0c0e423378bda03396634e69e519b..32355a3e56c2a1a922e7343f98c0736166f39e08 100644 (file)
@@ -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,
 };