SSU2: Compress large RIs in Session Confirmed

even if they would fit in the MTU uncompressed,
to save bandwidth and room for other blocks
This commit is contained in:
zzz
2022-03-15 07:23:53 -04:00
parent af5019c8dd
commit 587409daa7
3 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,9 @@
2022-03-13 zzz
2022-03-15 zzz
* SSU2: Fixes
2022-03-13 zzz
* SSU2: Fixes, stubs for relay and peer test (phase 2)
2022-03-12 zzz
* SSU2: Fixes
* Tunnels: Reduce build reply timeout

View File

@ -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 = 8;
public final static long BUILD = 9;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -469,7 +469,9 @@ class PacketBuilder2 {
if (numFragments * max != info.length)
numFragments++;
if (numFragments > 1) {
// try to reduce bandwidth and leave room for other blocks by gzipping
// if it is large, even if it would strictly fit
if (numFragments > 1 || info.length > 1000) {
byte[] gzipped = DataHelper.compress(info, 0, info.length, DataHelper.MAX_COMPRESSION);
if (gzipped.length < info.length) {
if (_log.shouldWarn())