I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 526aadb5 authored by zzz's avatar zzz
Browse files

NTCP2: Fix padding calculation for small frames

parent 8d629de2
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ public class RouterVersion { ...@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 20; public final static long BUILD = 21;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";
......
...@@ -915,6 +915,11 @@ public class NTCPConnection implements Closeable { ...@@ -915,6 +915,11 @@ public class NTCPConnection implements Closeable {
* @since 0.9.36 * @since 0.9.36
*/ */
private int getPaddingSize(int dataSize, int availForPad) { private int getPaddingSize(int dataSize, int availForPad) {
// since we're calculating with percentages, get at least a
// 0-16 range with the default 0% min 6% max,
// even for small dataSize.
if (dataSize < 256)
dataSize = 256;
// what we want to send, calculated in proportion to data size // what we want to send, calculated in proportion to data size
int minSend = (int) (dataSize * _paddingConfig.getSendMin()); int minSend = (int) (dataSize * _paddingConfig.getSendMin());
int maxSend = (int) (dataSize * _paddingConfig.getSendMax()); int maxSend = (int) (dataSize * _paddingConfig.getSendMax());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment