aboutsummaryrefslogtreecommitdiff
path: root/src/util/load.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-21 10:15:11 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-21 10:15:11 +0000
commit71db17bc50adc7c959838ca0bc9d5190c841e3c8 (patch)
treefb727743b5f11405d91b1908150a61afa289e1c3 /src/util/load.c
parent63267491ed45e12a9b50be5c8b0b32811d95c1e2 (diff)
downloadgnunet-71db17bc50adc7c959838ca0bc9d5190c841e3c8.tar.gz
gnunet-71db17bc50adc7c959838ca0bc9d5190c841e3c8.zip
cleaner
Diffstat (limited to 'src/util/load.c')
-rw-r--r--src/util/load.c10
1 files 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)
91 delta = GNUNET_TIME_absolute_get_duration (load->last_update); 91 delta = GNUNET_TIME_absolute_get_duration (load->last_update);
92 if (delta.value < load->autodecline.value) 92 if (delta.value < load->autodecline.value)
93 return; 93 return;
94 if (load->autodecline.value == 0)
95 {
96 load->runavg_delay = 0.0;
97 load->load = 0;
98 return;
99 }
94 n = delta.value / load->autodecline.value; 100 n = delta.value / load->autodecline.value;
95 if (n > 16) 101 if (n > 16)
96 { 102 {
@@ -121,8 +127,6 @@ GNUNET_LOAD_value_init (struct GNUNET_TIME_Relative autodecline)
121 127
122 ret = GNUNET_malloc (sizeof (struct GNUNET_LOAD_Value)); 128 ret = GNUNET_malloc (sizeof (struct GNUNET_LOAD_Value));
123 ret->autodecline = autodecline; 129 ret->autodecline = autodecline;
124 if (ret->autodecline.value == 0)
125 ret->autodecline.value = 1;
126 ret->last_update = GNUNET_TIME_absolute_get (); 130 ret->last_update = GNUNET_TIME_absolute_get ();
127 return ret; 131 return ret;
128} 132}
@@ -140,8 +144,6 @@ GNUNET_LOAD_value_set_decline (struct GNUNET_LOAD_Value *load,
140{ 144{
141 internal_update (load); 145 internal_update (load);
142 load->autodecline = autodecline; 146 load->autodecline = autodecline;
143 if (load->autodecline.value == 0)
144 load->autodecline.value = 1;
145} 147}
146 148
147 149