mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-06-04 13:01:36 +00:00
Hoist random() calls out of session synch blocks
This commit is contained in:
@@ -55,15 +55,14 @@ public class CSSHelper extends HelperBase {
|
||||
//I2PAppContext.getGlobalContext().logManager().getLog(CSSHelper.class).error("getNonce() null session", new Exception());
|
||||
return "FAIL_SESSION_NOT_SET";
|
||||
}
|
||||
String rv;
|
||||
// add a prefix to distinguish from other nonces for debugging
|
||||
String rv = "CN" + RandomSource.getInstance().nextLong();
|
||||
synchronized(session) {
|
||||
LinkedList<String> nonces = (LinkedList<String>) session.getAttribute(SESSION_CONSOLE_NONCE);
|
||||
if (nonces == null) {
|
||||
nonces = new LinkedList<String>();
|
||||
session.setAttribute(SESSION_CONSOLE_NONCE, nonces);
|
||||
}
|
||||
// add a prefix to distinguish from other nonces for debugging
|
||||
rv = "CN" + RandomSource.getInstance().nextLong();
|
||||
nonces.offer(rv);
|
||||
if (nonces.size() > NONCE_QUEUE_SIZE)
|
||||
nonces.poll();
|
||||
|
||||
Reference in New Issue
Block a user