diff --git a/history.txt b/history.txt index f88c598e0..02d5c483c 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2022-07-10 zzz + * SSU2: Fix NACK handling + 2022-07-09 zzz * Console: Only display news if a new entry is found * SSU2: Support other reason codes in destroy message diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 837dbdd0f..3c8f141dc 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Git"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 10; + public final static long BUILD = 11; /** for example "-test" */ public final static String EXTRA = ""; diff --git a/router/java/src/net/i2p/router/transport/udp/SSU2Bitfield.java b/router/java/src/net/i2p/router/transport/udp/SSU2Bitfield.java index df14fe2b4..db6c67ff7 100644 --- a/router/java/src/net/i2p/router/transport/udp/SSU2Bitfield.java +++ b/router/java/src/net/i2p/router/transport/udp/SSU2Bitfield.java @@ -268,8 +268,10 @@ class SSU2Bitfield { } // portion that is strictly newer for (long bit = bf2Highest + 1; bit <= highest; bit++) { - bf2.set(bit); - cb.bitSet(bit); + if (get(bit)) { + bf2.set(bit); + cb.bitSet(bit); + } } } } @@ -348,9 +350,24 @@ class SSU2Bitfield { public static void main(String[] args) { Callback cbi = new CallbackImpl(); - int off = 100; + int off = 0; SSU2Bitfield bf = new SSU2Bitfield(256, off); System.out.println(bf.toString()); + + for (int i = 0; i < 20; i++) { + bf.set(i); + } + for (int i = 21; i < 31; i++) { + bf.set(i); + } + bf.set(35); + System.out.println(bf.toString()); + System.out.println(bf.toAckBlock(10).toString()); + SSU2Bitfield bf2 = new SSU2Bitfield(256, off); + bf2.set(0); + bf.forEachAndNot(bf2, cbi); + if (true) return; + bf.toAckBlock(20); bf.set(off);