diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-26 20:08:17 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-26 20:08:29 +0100 |
commit | 9787c209921963ea60f1fdf5c8dc04a16cc344b3 (patch) | |
tree | 5ebc289d507fc655d736119ca09c25e5377d67b8 /src/cadet | |
parent | 0aca77d11fc5fe69f851e35c887e18ccb8fa60e5 (diff) | |
download | gnunet-9787c209921963ea60f1fdf5c8dc04a16cc344b3.tar.gz gnunet-9787c209921963ea60f1fdf5c8dc04a16cc344b3.zip |
improve future calculations if messages are skipped in unreliable in-order channels
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 12 |
1 files changed, 12 insertions, 0 deletions
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, | |||
1333 | env); | 1333 | env); |
1334 | ch->mid_recv.mid = htonl (1 + ntohl (ch->mid_recv.mid)); | 1334 | ch->mid_recv.mid = htonl (1 + ntohl (ch->mid_recv.mid)); |
1335 | ch->mid_futures >>= 1; | 1335 | ch->mid_futures >>= 1; |
1336 | if ( (GNUNET_YES == ch->out_of_order) && | ||
1337 | (GNUNET_NO == ch->reliable) ) | ||
1338 | { | ||
1339 | /* possibly shift by more if we skipped messages */ | ||
1340 | uint64_t delta = htonl (msg->mid.mid) - 1 - ntohl (ch->mid_recv.mid); | ||
1341 | |||
1342 | if (delta > 63) | ||
1343 | ch->mid_futures = 0; | ||
1344 | else | ||
1345 | ch->mid_futures >>= delta; | ||
1346 | ch->mid_recv.mid = htonl (1 + ntohl (msg->mid.mid)); | ||
1347 | } | ||
1336 | send_channel_data_ack (ch); | 1348 | send_channel_data_ack (ch); |
1337 | return; | 1349 | return; |
1338 | } | 1350 | } |