diff --git a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java index 195b892b1daa64df62d78304587dfa913c7e44a5..961ff539514179c8c752f3e7abf1936b3fa4a504 100644 --- a/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java +++ b/core/java/src/gnu/crypto/prng/AsyncFortunaStandalone.java @@ -17,13 +17,13 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl * The router must override this via the prng.buffers property in the router context. */ private static final int DEFAULT_BUFFERS = 2; - private static final int BUFSIZE = 256*1024; - private int _bufferCount; + private static final int DEFAULT_BUFSIZE = 256*1024; + private final int _bufferCount; private final byte asyncBuffers[][]; private final int status[]; private int nextBuf = 0; - private I2PAppContext _context; - private Log _log; + private final I2PAppContext _context; + private final Log _log; private static final int STATUS_NEED_FILL = 0; private static final int STATUS_FILLING = 1; @@ -33,7 +33,8 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl public AsyncFortunaStandalone(I2PAppContext context) { super(); _bufferCount = Math.max(context.getProperty("prng.buffers", DEFAULT_BUFFERS), 2); - asyncBuffers = new byte[_bufferCount][BUFSIZE]; + int bufferSize = Math.max(context.getProperty("prng.bufferSize", DEFAULT_BUFSIZE), 16*1024); + asyncBuffers = new byte[_bufferCount][bufferSize]; status = new int[_bufferCount]; for (int i = 0; i < _bufferCount; i++) status[i] = STATUS_NEED_FILL;