diff options
Diffstat (limited to 'src/fragmentation/fragmentation.c')
-rw-r--r-- | src/fragmentation/fragmentation.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index 21bbc538d..02444cf14 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c | |||
@@ -258,14 +258,18 @@ transmit_next (void *cls) | |||
258 | fsize); | 258 | fsize); |
259 | else | 259 | else |
260 | delay = GNUNET_TIME_UNIT_ZERO; | 260 | delay = GNUNET_TIME_UNIT_ZERO; |
261 | delay = GNUNET_TIME_relative_max (delay, | 261 | if (fc->num_rounds < 64) |
262 | GNUNET_TIME_relative_multiply (fc->msg_delay, | 262 | delay = GNUNET_TIME_relative_max (delay, |
263 | (1ULL << fc->num_rounds))); | 263 | GNUNET_TIME_relative_saturating_multiply |
264 | (fc->msg_delay, | ||
265 | (1ULL << fc->num_rounds))); | ||
266 | else | ||
267 | delay = GNUNET_TIME_UNIT_FOREVER_REL; | ||
264 | if (wrap) | 268 | if (wrap) |
265 | { | 269 | { |
266 | /* full round transmitted wait 2x delay for ACK before going again */ | 270 | /* full round transmitted wait 2x delay for ACK before going again */ |
267 | fc->num_rounds++; | 271 | fc->num_rounds++; |
268 | delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2); | 272 | delay = GNUNET_TIME_relative_saturating_multiply (fc->ack_delay, 2); |
269 | /* never use zero, need some time for ACK always */ | 273 | /* never use zero, need some time for ACK always */ |
270 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); | 274 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); |
271 | fc->wack = GNUNET_YES; | 275 | fc->wack = GNUNET_YES; |
@@ -428,8 +432,8 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
428 | if (0 == ack_cnt) | 432 | if (0 == ack_cnt) |
429 | { | 433 | { |
430 | /* complete loss */ | 434 | /* complete loss */ |
431 | fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, | 435 | fc->msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay, |
432 | snd_cnt); | 436 | snd_cnt); |
433 | } | 437 | } |
434 | else if (snd_cnt > ack_cnt) | 438 | else if (snd_cnt > ack_cnt) |
435 | { | 439 | { |
@@ -511,8 +515,8 @@ GNUNET_FRAGMENT_context_destroy (struct GNUNET_FRAGMENT_Context *fc, | |||
511 | if (NULL != ack_delay) | 515 | if (NULL != ack_delay) |
512 | *ack_delay = fc->ack_delay; | 516 | *ack_delay = fc->ack_delay; |
513 | if (NULL != msg_delay) | 517 | if (NULL != msg_delay) |
514 | *msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, | 518 | *msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay, |
515 | fc->num_rounds); | 519 | fc->num_rounds); |
516 | GNUNET_free (fc); | 520 | GNUNET_free (fc); |
517 | } | 521 | } |
518 | 522 | ||