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

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

* Random: Add config setting prng.bufferSize to override the default 256 KB

parent 3f5022cb
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
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