-LRN: fix normal child death restart.
authorChristian Grothoff <christian@grothoff.org>
Sun, 25 Dec 2011 20:51:03 +0000 (20:51 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 25 Dec 2011 20:51:03 +0000 (20:51 +0000)
It does work in the sense that child process is restarted.
However, i didn't have an opportunity to test it for non-default
processes (default processes are restarted immediately; non-default
processes should be restarted on demand).

src/arm/gnunet-service-arm.c

index 733eac6c613492f460c33f5523dffcbc557ac966..e8e1113f0b51519929d93d7556e0abf88843dd52 100644 (file)
@@ -903,19 +903,21 @@ maint_child_death (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
            {
              /* process terminated normally, allow restart at any time */
              pos->restart_at.abs_value = 0;
-             continue;
            }
-         if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
-           GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                       _
-                       ("Service `%s' terminated with status %s/%d, will restart in %llu ms\n"),
-                       pos->name, statstr, statcode, pos->backoff.rel_value);
-         /* schedule restart */
-         pos->restart_at = GNUNET_TIME_relative_to_absolute (pos->backoff);
-         pos->backoff =
-           GNUNET_TIME_relative_min (EXPONENTIAL_BACKOFF_THRESHOLD,
-                                     GNUNET_TIME_relative_multiply
-                                     (pos->backoff, 2));
+          else
+            {
+             if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+               GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                           _
+                           ("Service `%s' terminated with status %s/%d, will restart in %llu ms\n"),
+                           pos->name, statstr, statcode, pos->backoff.rel_value);
+             /* schedule restart */
+             pos->restart_at = GNUNET_TIME_relative_to_absolute (pos->backoff);
+             pos->backoff =
+               GNUNET_TIME_relative_min (EXPONENTIAL_BACKOFF_THRESHOLD,
+                                         GNUNET_TIME_relative_multiply
+                                         (pos->backoff, 2));
+            }
          if (GNUNET_SCHEDULER_NO_TASK != child_restart_task)
            GNUNET_SCHEDULER_cancel (child_restart_task);
          child_restart_task =