diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-21 15:54:30 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-21 15:54:30 +0000 |
commit | 3c8dd575bcc3f22b58b13f4cb096c57f076bf2e4 (patch) | |
tree | 424d24d369b44ef55ff18cc26a3788ca665177e0 /src/fragmentation/defragmentation.c | |
parent | 7cf34aed85b236da3d76dcba438a7082876985a4 (diff) | |
download | gnunet-3c8dd575bcc3f22b58b13f4cb096c57f076bf2e4.tar.gz gnunet-3c8dd575bcc3f22b58b13f4cb096c57f076bf2e4.zip |
order of sending ack and notification
Diffstat (limited to 'src/fragmentation/defragmentation.c')
-rw-r--r-- | src/fragmentation/defragmentation.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c index 6246163a6..b07f20407 100644 --- a/src/fragmentation/defragmentation.c +++ b/src/fragmentation/defragmentation.c | |||
@@ -519,21 +519,26 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc, | |||
519 | for (b = 0; b < 64; b++) | 519 | for (b = 0; b < 64; b++) |
520 | if (0 != (mc->bits & (1LL << b))) | 520 | if (0 != (mc->bits & (1LL << b))) |
521 | bc++; | 521 | bc++; |
522 | |||
523 | /* notify about complete message */ | ||
524 | if ((duplicate == GNUNET_NO) && (0 == mc->bits)) | ||
525 | { | ||
526 | GNUNET_STATISTICS_update (dc->stats, _("# messages defragmented"), 1, | ||
527 | GNUNET_NO); | ||
528 | /* message complete, notify! */ | ||
529 | dc->proc (dc->cls, mc->msg); | ||
530 | } | ||
531 | /* send ACK */ | ||
522 | if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1) | 532 | if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1) |
523 | dc->latency = estimate_latency (mc); | 533 | dc->latency = estimate_latency (mc); |
524 | delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1); | 534 | delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1); |
525 | if ((0 == mc->bits) || (GNUNET_YES == duplicate)) /* message complete or duplicate, ACK now! */ | 535 | if ((0 == mc->bits) || (GNUNET_YES == duplicate)) /* message complete or duplicate, ACK now! */ |
536 | { | ||
526 | delay = GNUNET_TIME_UNIT_ZERO; | 537 | delay = GNUNET_TIME_UNIT_ZERO; |
538 | } | ||
527 | if (GNUNET_SCHEDULER_NO_TASK != mc->ack_task) | 539 | if (GNUNET_SCHEDULER_NO_TASK != mc->ack_task) |
528 | GNUNET_SCHEDULER_cancel (mc->ack_task); | 540 | GNUNET_SCHEDULER_cancel (mc->ack_task); |
529 | mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc); | 541 | mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc); |
530 | if ((duplicate == GNUNET_NO) && (0 == mc->bits)) | ||
531 | { | ||
532 | GNUNET_STATISTICS_update (dc->stats, _("# messages defragmented"), 1, | ||
533 | GNUNET_NO); | ||
534 | /* message complete, notify! */ | ||
535 | dc->proc (dc->cls, mc->msg); | ||
536 | } | ||
537 | if (duplicate == GNUNET_YES) | 542 | if (duplicate == GNUNET_YES) |
538 | return GNUNET_NO; | 543 | return GNUNET_NO; |
539 | return GNUNET_YES; | 544 | return GNUNET_YES; |