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

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

prevent negative sleep

parent 25d1ae19
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ public class DHSessionKeyBuilder { ...@@ -64,7 +64,7 @@ public class DHSessionKeyBuilder {
private final static String PROP_DH_PRECALC_DELAY = "crypto.dh.precalc.delay"; private final static String PROP_DH_PRECALC_DELAY = "crypto.dh.precalc.delay";
private final static int DEFAULT_DH_PRECALC_MIN = 20; private final static int DEFAULT_DH_PRECALC_MIN = 20;
private final static int DEFAULT_DH_PRECALC_MAX = 60; private final static int DEFAULT_DH_PRECALC_MAX = 60;
private final static int DEFAULT_DH_PRECALC_DELAY = 50; private final static int DEFAULT_DH_PRECALC_DELAY = 25;
/** /**
* Create a new public/private value pair for the DH exchange. * Create a new public/private value pair for the DH exchange.
...@@ -505,7 +505,7 @@ public class DHSessionKeyBuilder { ...@@ -505,7 +505,7 @@ public class DHSessionKeyBuilder {
long curCalc = System.currentTimeMillis() - curStart; long curCalc = System.currentTimeMillis() - curStart;
// for some relief... // for some relief...
try { try {
Thread.sleep(_calcDelay + (curCalc * 3)); Thread.sleep(Math.min(200, Math.max(10, _calcDelay + (curCalc * 3))));
} catch (InterruptedException ie) { // nop } catch (InterruptedException ie) { // nop
} }
} }
......
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