From: Christian Grothoff Date: Mon, 8 Mar 2010 18:39:29 +0000 (+0000) Subject: make llvm happy X-Git-Tag: initial-import-from-subversion-38251~22541 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=131ac7a2f8ca9dda193d5f144ac02a65d7f66c81;p=oweals%2Fgnunet.git make llvm happy --- 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) left_bytes = delta_avail - av->consumption_since_last_update__; avail_per_ms = ((unsigned long long) av->available_bytes_per_s__) / 1000LL; if (avail_per_ms > 0) - left_time_ms = left_bytes / avail_per_ms; - else - left_time_ms = 0; - if (left_time_ms > ((unsigned long long) av->max_carry_s__) * 1000LL) { - /* need to limit accumulation of unused bandwidth */ - left_time_ms = ((unsigned long long) av->max_carry_s__) * 1000LL; - if (left_time_ms * avail_per_ms < GNUNET_SERVER_MAX_MESSAGE_SIZE) + left_time_ms = left_bytes / avail_per_ms; + if (left_time_ms > ((unsigned long long) av->max_carry_s__) * 1000LL) { - /* need to still allow GNUNET_SERVER_MAX_MESSAGE_SIZE accumulation */ - if (left_bytes > GNUNET_SERVER_MAX_MESSAGE_SIZE) - left_bytes = GNUNET_SERVER_MAX_MESSAGE_SIZE; - left_time_ms = left_bytes / avail_per_ms; + /* need to limit accumulation of unused bandwidth */ + left_time_ms = ((unsigned long long) av->max_carry_s__) * 1000LL; + if (left_time_ms * avail_per_ms < GNUNET_SERVER_MAX_MESSAGE_SIZE) + { + /* need to still allow GNUNET_SERVER_MAX_MESSAGE_SIZE accumulation */ + if (left_bytes > GNUNET_SERVER_MAX_MESSAGE_SIZE) + left_bytes = GNUNET_SERVER_MAX_MESSAGE_SIZE; + left_time_ms = left_bytes / avail_per_ms; + } + } + else + { + left_time_ms = 0; } } av->consumption_since_last_update__ = 0;