mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-08-29 03:18:45 +00:00
Test: LocalClientManager fixes/improvements
- Fix NPEs caused by netdb changes - Fix drop option - Add rate limiter option to LocalClientManager
This commit is contained in:
@@ -369,7 +369,10 @@ public class RouterContext extends I2PAppContext {
|
||||
*/
|
||||
public SegmentedNetworkDatabaseFacade netDbSegmentor() { return _netDb; }
|
||||
|
||||
public NetworkDatabaseFacade netDb() { return _netDb.mainNetDB(); }
|
||||
/**
|
||||
* @return may be null if called very early or in some unit tests
|
||||
*/
|
||||
public NetworkDatabaseFacade netDb() { return _netDb != null ? _netDb.mainNetDB() : null; }
|
||||
|
||||
/**
|
||||
* Get the client netDb for the given id.
|
||||
|
||||
@@ -675,7 +675,8 @@ class ClientConnectionRunner {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isPrimary && _floodfillNetworkDatabaseFacade == null) {
|
||||
// router() null for some unit tests
|
||||
if (isPrimary && _floodfillNetworkDatabaseFacade == null && _context.router() != null) {
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Initializing subDb for client" + destHash);
|
||||
_floodfillNetworkDatabaseFacade = new FloodfillNetworkDatabaseFacade(_context, destHash);
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.i2p.data.i2cp.SetDateMessage;
|
||||
import net.i2p.internal.I2CPMessageQueue;
|
||||
import net.i2p.router.ClientManagerFacade;
|
||||
import net.i2p.router.ClientMessage;
|
||||
import net.i2p.router.CommSystemFacade;
|
||||
import net.i2p.router.Job;
|
||||
import net.i2p.router.JobImpl;
|
||||
import net.i2p.router.RouterContext;
|
||||
@@ -433,7 +434,8 @@ class ClientManager {
|
||||
* @since 0.9.12
|
||||
*/
|
||||
private SessionId locked_getNextSessionId() {
|
||||
if (_ctx.commSystem().isDummy())
|
||||
CommSystemFacade csf = _ctx.commSystem();
|
||||
if (csf != null && csf.isDummy()) // unit tests if null
|
||||
return null;
|
||||
int max = Math.max(1, Math.min(2048, _ctx.getProperty(PROP_MAX_SESSIONS, DEFAULT_MAX_SESSIONS)));
|
||||
if (_runnerSessionIds.size() >= max) {
|
||||
|
||||
Reference in New Issue
Block a user