From b0963a5108cd2a95cb862a1ac061892f68d7bba4 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Mon, 27 Apr 2015 19:16:01 +0000 Subject: [PATCH] - skip checking all messages that are not there, no matter what the bitfield says --- src/cadet/gnunet-service-cadet_channel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 2fd0a8e09..e529f8ecb 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -1060,15 +1060,18 @@ channel_rel_free_sent (struct CadetChannelReliability *rel, /* Did we run out of copies? (previously freed, it's ok) */ if (NULL == copy) { - LOG (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n"); - return; + LOG (GNUNET_ERROR_TYPE_DEBUG, "run out of copies...\n"); + return; } /* Did we overshoot the target? (previously freed, it's ok) */ if (GC_is_pid_bigger (copy->mid, target)) { - LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid); - continue; + LOG (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid); + i += copy->mid - target - 1; /* MID: 90, t = 85, i += 4 (i++ later) */ + mask = (0x1LL << (i + 1)) - 1; /* Mask = i-th bit and all before */ + bitfield &= ~mask; + continue; } /* Now copy->mid == target, free it */ -- 2.25.1