diff options
author | David Barksdale <amatus@amatus.name> | 2016-11-17 23:24:43 -0600 |
---|---|---|
committer | David Barksdale <amatus@amatus.name> | 2016-11-17 23:24:43 -0600 |
commit | 12597da2a33fe196a785a656136cba7675a06e21 (patch) | |
tree | c189c7fb7f2835f8219622400d83c453a91dbb69 /src/fragmentation/fragmentation.c | |
parent | cdeb1253bfda209def1ef48b436ff09cf7ab8be6 (diff) | |
download | gnunet-12597da2a33fe196a785a656136cba7675a06e21.tar.gz gnunet-12597da2a33fe196a785a656136cba7675a06e21.zip |
Sometimes it's OK if multiplication overflows
Diffstat (limited to 'src/fragmentation/fragmentation.c')
-rw-r--r-- | src/fragmentation/fragmentation.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index eb0bad675..02444cf14 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c | |||
@@ -260,7 +260,7 @@ transmit_next (void *cls) | |||
260 | delay = GNUNET_TIME_UNIT_ZERO; | 260 | delay = GNUNET_TIME_UNIT_ZERO; |
261 | if (fc->num_rounds < 64) | 261 | if (fc->num_rounds < 64) |
262 | delay = GNUNET_TIME_relative_max (delay, | 262 | delay = GNUNET_TIME_relative_max (delay, |
263 | GNUNET_TIME_relative_multiply | 263 | GNUNET_TIME_relative_saturating_multiply |
264 | (fc->msg_delay, | 264 | (fc->msg_delay, |
265 | (1ULL << fc->num_rounds))); | 265 | (1ULL << fc->num_rounds))); |
266 | else | 266 | else |
@@ -269,7 +269,7 @@ transmit_next (void *cls) | |||
269 | { | 269 | { |
270 | /* full round transmitted wait 2x delay for ACK before going again */ | 270 | /* full round transmitted wait 2x delay for ACK before going again */ |
271 | fc->num_rounds++; | 271 | fc->num_rounds++; |
272 | delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2); | 272 | delay = GNUNET_TIME_relative_saturating_multiply (fc->ack_delay, 2); |
273 | /* never use zero, need some time for ACK always */ | 273 | /* never use zero, need some time for ACK always */ |
274 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); | 274 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); |
275 | fc->wack = GNUNET_YES; | 275 | fc->wack = GNUNET_YES; |
@@ -432,8 +432,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
432 | if (0 == ack_cnt) | 432 | if (0 == ack_cnt) |
433 | { | 433 | { |
434 | /* complete loss */ | 434 | /* complete loss */ |
435 | fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, | 435 | fc->msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay, |
436 | snd_cnt); | 436 | snd_cnt); |
437 | } | 437 | } |
438 | else if (snd_cnt > ack_cnt) | 438 | else if (snd_cnt > ack_cnt) |
439 | { | 439 | { |
@@ -515,8 +515,8 @@ GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc, | |||
515 | if (NULL != ack_delay) | 515 | if (NULL != ack_delay) |
516 | *ack_delay = fc->ack_delay; | 516 | *ack_delay = fc->ack_delay; |
517 | if (NULL != msg_delay) | 517 | if (NULL != msg_delay) |
518 | *msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, | 518 | *msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay, |
519 | fc->num_rounds); | 519 | fc->num_rounds); |
520 | GNUNET_free (fc); | 520 | GNUNET_free (fc); |
521 | } | 521 | } |
522 | 522 | ||