Transport: Interrupt DH refiller thread when pool is empty,

to speed refilling and reduce pumper stalls
Reduces empties by 10x
This commit is contained in:
zzz
2015-12-01 20:09:22 +00:00
parent f778c23f0b
commit dfbbe3e928

View File

@@ -505,9 +505,10 @@ public class DHSessionKeyBuilder {
break;
long curCalc = System.currentTimeMillis() - curStart;
// for some relief...
try {
Thread.sleep(Math.min(200, Math.max(10, _calcDelay + (curCalc * 3))));
} catch (InterruptedException ie) { // nop
if (!interrupted()) {
try {
Thread.sleep(Math.min(200, Math.max(10, _calcDelay + (curCalc * 3))));
} catch (InterruptedException ie) {}
}
}
}
@@ -541,6 +542,8 @@ public class DHSessionKeyBuilder {
if (_log.shouldLog(Log.INFO)) _log.info("No more builders, creating one now");
_context.statManager().addRateData("crypto.DHEmpty", 1);
builder = precalc();
// stop sleeping, wake up, make some more
this.interrupt();
}
return builder;
}