forked from I2P_Developers/i2p.i2p
NTCP2: Fix padding calculation for small frames
This commit is contained in:
@@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 20;
|
||||
public final static long BUILD = 21;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@@ -915,6 +915,11 @@ public class NTCPConnection implements Closeable {
|
||||
* @since 0.9.36
|
||||
*/
|
||||
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
|
||||
int minSend = (int) (dataSize * _paddingConfig.getSendMin());
|
||||
int maxSend = (int) (dataSize * _paddingConfig.getSendMax());
|
||||
|
Reference in New Issue
Block a user