From 023cf4e2f6a6d50c40e6717fcc67bb598f0f54a9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 8 Mar 2015 14:33:42 +0000 Subject: -always assume at least MIN bandwidth, even if we got no quota or a quota lower than min --- src/util/bandwidth.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/util/bandwidth.c') diff --git a/src/util/bandwidth.c b/src/util/bandwidth.c index 1ed87ff9b..3b9b64239 100644 --- a/src/util/bandwidth.c +++ b/src/util/bandwidth.c @@ -61,7 +61,26 @@ GNUNET_BANDWIDTH_value_min (struct GNUNET_BANDWIDTH_Value32NBO b1, { return GNUNET_BANDWIDTH_value_init (GNUNET_MIN - (ntohl (b1.value__), ntohl (b2.value__))); + (ntohl (b1.value__), + ntohl (b2.value__))); +} + + +/** + * Compute the MAX of two bandwidth values. + * + * @param b1 first value + * @param b2 second value + * @return the min of b1 and b2 + */ +struct GNUNET_BANDWIDTH_Value32NBO +GNUNET_BANDWIDTH_value_max (struct GNUNET_BANDWIDTH_Value32NBO b1, + struct GNUNET_BANDWIDTH_Value32NBO b2) +{ + return + GNUNET_BANDWIDTH_value_init (GNUNET_MAX + (ntohl (b1.value__), + ntohl (b2.value__))); } -- cgit v1.2.3