diff options
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/gnunet-service-arm.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 19088c5cb..2db2ba0d1 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -1833,7 +1833,21 @@ maint_child_death (void *cls) | |||
1833 | statcode, | 1833 | statcode, |
1834 | GNUNET_STRINGS_relative_time_to_string (pos->backoff, | 1834 | GNUNET_STRINGS_relative_time_to_string (pos->backoff, |
1835 | GNUNET_YES)); | 1835 | GNUNET_YES)); |
1836 | /* schedule restart */ | 1836 | { |
1837 | /* Reduce backoff based on runtime of the process, | ||
1838 | so that there is a cool-down if a process actually | ||
1839 | runs for a while. */ | ||
1840 | struct GNUNET_TIME_Relative runtime; | ||
1841 | unsigned int minutes; | ||
1842 | |||
1843 | runtime = GNUNET_TIME_absolute_get_duration (pos->restart_at); | ||
1844 | minutes = runtime.rel_value_us / GNUNET_TIME_UNIT_MINUTES.rel_value_us; | ||
1845 | if (minutes > 31) | ||
1846 | pos->backoff = GNUNET_TIME_UNIT_ZERO; | ||
1847 | else | ||
1848 | pos->backoff.rel_value_us <<= minutes; | ||
1849 | } | ||
1850 | /* schedule restart */ | ||
1837 | pos->restart_at = GNUNET_TIME_relative_to_absolute (pos->backoff); | 1851 | pos->restart_at = GNUNET_TIME_relative_to_absolute (pos->backoff); |
1838 | pos->backoff = GNUNET_TIME_STD_BACKOFF (pos->backoff); | 1852 | pos->backoff = GNUNET_TIME_STD_BACKOFF (pos->backoff); |
1839 | if (NULL != child_restart_task) | 1853 | if (NULL != child_restart_task) |