if a client reconnects, we always want to get a new leaseSet ASAP (even if the pool hadn't been marked as stopped yet)
logging
This commit is contained in:
@ -53,11 +53,14 @@ class ClientLeaseSetManagerJob extends JobImpl {
|
||||
_lastCreated = -1;
|
||||
}
|
||||
|
||||
public void forceRequestLease() { _forceRequestLease = true; }
|
||||
public void forceRequestLease() {
|
||||
_currentLeaseSet = null;
|
||||
_forceRequestLease = true;
|
||||
}
|
||||
|
||||
public String getName() { return "Manage Client Lease Set"; }
|
||||
public void runJob() {
|
||||
if (_pool.isStopped()) {
|
||||
if ((!_forceRequestLease) && (_pool.isStopped()) ) {
|
||||
if ( (_pool.getInactiveInboundTunnelIds().size() <= 0) &&
|
||||
(_pool.getInboundTunnelIds().size() <= 0) ) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
|
@ -43,32 +43,43 @@ class ClientTunnelPool {
|
||||
}
|
||||
|
||||
public void startPool() {
|
||||
if (!_isStopped) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Pool " + _poolId +": Not starting the pool /again/ (its already running)");
|
||||
return;
|
||||
} else {
|
||||
//if (!_isStopped) {
|
||||
// if (_log.shouldLog(Log.ERROR))
|
||||
// _log.error("Pool " + _poolId +": Not starting the pool /again/ (its already running)");
|
||||
// return;
|
||||
//} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Pool " + _poolId +": Starting up the pool ");
|
||||
}
|
||||
//}
|
||||
_isStopped = false;
|
||||
|
||||
if (_mgrJob == null) {
|
||||
_mgrJob = new ClientTunnelPoolManagerJob(_context, _pool, this);
|
||||
_context.jobQueue().addJob(_mgrJob);
|
||||
} else {
|
||||
_mgrJob.getTiming().setStartAfter(_context.clock().now());
|
||||
_context.jobQueue().addJob(_mgrJob);
|
||||
}
|
||||
|
||||
if (_leaseMgrJob == null) {
|
||||
_leaseMgrJob = new ClientLeaseSetManagerJob(_context, this);
|
||||
_context.jobQueue().addJob(_leaseMgrJob);
|
||||
} else {
|
||||
// we just restarted, so make sure we ask for a new leaseSet ASAP
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("restarting the client pool and requesting a new leaseSet");
|
||||
_leaseMgrJob.forceRequestLease();
|
||||
_leaseMgrJob.getTiming().setStartAfter(_context.clock().now());
|
||||
_context.jobQueue().addJob(_leaseMgrJob);
|
||||
}
|
||||
|
||||
if (_tunnelExpirationJob == null) {
|
||||
_tunnelExpirationJob = new ClientTunnelPoolExpirationJob(_context, this, _pool);
|
||||
_context.jobQueue().addJob(_tunnelExpirationJob);
|
||||
}
|
||||
} else {
|
||||
_tunnelExpirationJob.getTiming().setStartAfter(_context.clock().now());
|
||||
_context.jobQueue().addJob(_tunnelExpirationJob);
|
||||
}
|
||||
}
|
||||
public void stopPool() { _isStopped = true; }
|
||||
public boolean isStopped() { return _isStopped; }
|
||||
|
@ -130,8 +130,12 @@ public class PoolingTunnelManagerFacade implements TunnelManagerFacade {
|
||||
public void createTunnels(Destination destination, ClientTunnelSettings clientSettings, long timeoutMs) {
|
||||
ClientTunnelPool pool = _pool.getClientPool(destination);
|
||||
if (pool != null) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("createTunnels for destination " + destination.calculateHash().toBase64() + " where the client pool exists");
|
||||
pool.setClientSettings(clientSettings);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("createTunnels for destination " + destination.calculateHash().toBase64() + " where the client pool does NOT exist");
|
||||
_pool.createClientPool(destination, clientSettings);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user