aboutsummaryrefslogtreecommitdiff
path: root/src/util/bandwidth.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-03-08 18:39:29 +0000
committerChristian Grothoff <christian@grothoff.org>2010-03-08 18:39:29 +0000
commit131ac7a2f8ca9dda193d5f144ac02a65d7f66c81 (patch)
treead5c0f7da9b07ebb344e0425569eb8063a4d684f /src/util/bandwidth.c
parent07b47378d032c80c50410f6432c52113b2db9455 (diff)
downloadgnunet-131ac7a2f8ca9dda193d5f144ac02a65d7f66c81.tar.gz
gnunet-131ac7a2f8ca9dda193d5f144ac02a65d7f66c81.zip
make llvm happy
Diffstat (limited to 'src/util/bandwidth.c')
-rw-r--r--src/util/bandwidth.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c
index 099c7d080..391c43406 100644
--- a/src/util/bandwidth.c
+++ b/src/util/bandwidth.c
@@ -156,19 +156,23 @@ update_tracker (struct GNUNET_BANDWIDTH_Tracker *av)
156 left_bytes = delta_avail - av->consumption_since_last_update__; 156 left_bytes = delta_avail - av->consumption_since_last_update__;
157 avail_per_ms = ((unsigned long long) av->available_bytes_per_s__) / 1000LL; 157 avail_per_ms = ((unsigned long long) av->available_bytes_per_s__) / 1000LL;
158 if (avail_per_ms > 0) 158 if (avail_per_ms > 0)
159 left_time_ms = left_bytes / avail_per_ms;
160 else
161 left_time_ms = 0;
162 if (left_time_ms > ((unsigned long long) av->max_carry_s__) * 1000LL)
163 { 159 {
164 /* need to limit accumulation of unused bandwidth */ 160 left_time_ms = left_bytes / avail_per_ms;
165 left_time_ms = ((unsigned long long) av->max_carry_s__) * 1000LL; 161 if (left_time_ms > ((unsigned long long) av->max_carry_s__) * 1000LL)
166 if (left_time_ms * avail_per_ms < GNUNET_SERVER_MAX_MESSAGE_SIZE)
167 { 162 {
168 /* need to still allow GNUNET_SERVER_MAX_MESSAGE_SIZE accumulation */ 163 /* need to limit accumulation of unused bandwidth */
169 if (left_bytes > GNUNET_SERVER_MAX_MESSAGE_SIZE) 164 left_time_ms = ((unsigned long long) av->max_carry_s__) * 1000LL;
170 left_bytes = GNUNET_SERVER_MAX_MESSAGE_SIZE; 165 if (left_time_ms * avail_per_ms < GNUNET_SERVER_MAX_MESSAGE_SIZE)
171 left_time_ms = left_bytes / avail_per_ms; 166 {
167 /* need to still allow GNUNET_SERVER_MAX_MESSAGE_SIZE accumulation */
168 if (left_bytes > GNUNET_SERVER_MAX_MESSAGE_SIZE)
169 left_bytes = GNUNET_SERVER_MAX_MESSAGE_SIZE;
170 left_time_ms = left_bytes / avail_per_ms;
171 }
172 }
173 else
174 {
175 left_time_ms = 0;
172 } 176 }
173 } 177 }
174 av->consumption_since_last_update__ = 0; 178 av->consumption_since_last_update__ = 0;