aboutsummaryrefslogtreecommitdiff
path: root/src/fragmentation
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-21 15:54:30 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-21 15:54:30 +0000
commit3c8dd575bcc3f22b58b13f4cb096c57f076bf2e4 (patch)
tree424d24d369b44ef55ff18cc26a3788ca665177e0 /src/fragmentation
parent7cf34aed85b236da3d76dcba438a7082876985a4 (diff)
order of sending ack and notification
Diffstat (limited to 'src/fragmentation')
-rw-r--r--src/fragmentation/defragmentation.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/fragmentation/defragmentation.c b/src/fragmentation/defragmentation.c
index 6246163a69..b07f204077 100644
--- a/src/fragmentation/defragmentation.c
+++ b/src/fragmentation/defragmentation.c
@@ -519,21 +519,26 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
for (b = 0; b < 64; b++)
if (0 != (mc->bits & (1LL << b)))
bc++;
+
+ /* notify about complete message */
+ if ((duplicate == GNUNET_NO) && (0 == mc->bits))
+ {
+ GNUNET_STATISTICS_update (dc->stats, _("# messages defragmented"), 1,
+ GNUNET_NO);
+ /* message complete, notify! */
+ dc->proc (dc->cls, mc->msg);
+ }
+ /* send ACK */
if (mc->frag_times_write_offset - mc->frag_times_start_offset > 1)
dc->latency = estimate_latency (mc);
delay = GNUNET_TIME_relative_multiply (dc->latency, bc + 1);
if ((0 == mc->bits) || (GNUNET_YES == duplicate)) /* message complete or duplicate, ACK now! */
+ {
delay = GNUNET_TIME_UNIT_ZERO;
+ }
if (GNUNET_SCHEDULER_NO_TASK != mc->ack_task)
GNUNET_SCHEDULER_cancel (mc->ack_task);
mc->ack_task = GNUNET_SCHEDULER_add_delayed (delay, &send_ack, mc);
- if ((duplicate == GNUNET_NO) && (0 == mc->bits))
- {
- GNUNET_STATISTICS_update (dc->stats, _("# messages defragmented"), 1,
- GNUNET_NO);
- /* message complete, notify! */
- dc->proc (dc->cls, mc->msg);
- }
if (duplicate == GNUNET_YES)
return GNUNET_NO;
return GNUNET_YES;