From: Christian Grothoff Date: Tue, 26 Feb 2019 19:08:17 +0000 (+0100) Subject: improve future calculations if messages are skipped in unreliable in-order channels X-Git-Tag: v0.11.0~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9787c209921963ea60f1fdf5c8dc04a16cc344b3;p=oweals%2Fgnunet.git improve future calculations if messages are skipped in unreliable in-order channels --- diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 905211e00..10df917ff 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -1333,6 +1333,18 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, env); ch->mid_recv.mid = htonl (1 + ntohl (ch->mid_recv.mid)); ch->mid_futures >>= 1; + if ( (GNUNET_YES == ch->out_of_order) && + (GNUNET_NO == ch->reliable) ) + { + /* possibly shift by more if we skipped messages */ + uint64_t delta = htonl (msg->mid.mid) - 1 - ntohl (ch->mid_recv.mid); + + if (delta > 63) + ch->mid_futures = 0; + else + ch->mid_futures >>= delta; + ch->mid_recv.mid = htonl (1 + ntohl (msg->mid.mid)); + } send_channel_data_ack (ch); return; }