From 71db17bc50adc7c959838ca0bc9d5190c841e3c8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 21 Oct 2010 10:15:11 +0000 Subject: [PATCH] cleaner --- src/util/load.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/load.c b/src/util/load.c index 3f03e32e7..5bcf220be 100644 --- a/src/util/load.c +++ b/src/util/load.c @@ -91,6 +91,12 @@ internal_update (struct GNUNET_LOAD_Value *load) delta = GNUNET_TIME_absolute_get_duration (load->last_update); if (delta.value < load->autodecline.value) return; + if (load->autodecline.value == 0) + { + load->runavg_delay = 0.0; + load->load = 0; + return; + } n = delta.value / load->autodecline.value; if (n > 16) { @@ -121,8 +127,6 @@ GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline) ret = GNUNET_malloc (sizeof (struct GNUNET_LOAD_Value)); ret->autodecline = autodecline; - if (ret->autodecline.value == 0) - ret->autodecline.value = 1; ret->last_update = GNUNET_TIME_absolute_get (); return ret; } @@ -140,8 +144,6 @@ GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load, { internal_update (load); load->autodecline = autodecline; - if (load->autodecline.value == 0) - load->autodecline.value = 1; } -- 2.25.1