projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
65a922f
)
-avoid overflow in calculation for very large values
author
Christian Grothoff
<christian@grothoff.org>
Tue, 26 Jul 2016 20:39:59 +0000
(20:39 +0000)
committer
Christian Grothoff
<christian@grothoff.org>
Tue, 26 Jul 2016 20:39:59 +0000
(20:39 +0000)
src/util/bandwidth.c
patch
|
blob
|
history
diff --git
a/src/util/bandwidth.c
b/src/util/bandwidth.c
index 008963c3c0d52c8677506ee4e7ec576781b6d9ec..980af764a0638aa954ba0f2b06c6c513368c8f4a 100644
(file)
--- a/
src/util/bandwidth.c
+++ b/
src/util/bandwidth.c
@@
-203,10
+203,9
@@
update_excess (struct GNUNET_BANDWIDTH_Tracker *av)
}
else
{
+ double factor = 1.0 * left_bytes / (double) av->available_bytes_per_s__;
delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
- left_bytes);
- delay = GNUNET_TIME_relative_divide (delay,
- av->available_bytes_per_s__);
+ (unsigned long long) factor);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %llu bps it will take us %s for %lld bytes to reach excess threshold\n",