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;
|
_lastCreated = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceRequestLease() { _forceRequestLease = true; }
|
public void forceRequestLease() {
|
||||||
|
_currentLeaseSet = null;
|
||||||
|
_forceRequestLease = true;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() { return "Manage Client Lease Set"; }
|
public String getName() { return "Manage Client Lease Set"; }
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
if (_pool.isStopped()) {
|
if ((!_forceRequestLease) && (_pool.isStopped()) ) {
|
||||||
if ( (_pool.getInactiveInboundTunnelIds().size() <= 0) &&
|
if ( (_pool.getInactiveInboundTunnelIds().size() <= 0) &&
|
||||||
(_pool.getInboundTunnelIds().size() <= 0) ) {
|
(_pool.getInboundTunnelIds().size() <= 0) ) {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
|
@ -43,32 +43,43 @@ class ClientTunnelPool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startPool() {
|
public void startPool() {
|
||||||
if (!_isStopped) {
|
//if (!_isStopped) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
// if (_log.shouldLog(Log.ERROR))
|
||||||
_log.warn("Pool " + _poolId +": Not starting the pool /again/ (its already running)");
|
// _log.error("Pool " + _poolId +": Not starting the pool /again/ (its already running)");
|
||||||
return;
|
// return;
|
||||||
} else {
|
//} else {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Pool " + _poolId +": Starting up the pool ");
|
_log.info("Pool " + _poolId +": Starting up the pool ");
|
||||||
}
|
//}
|
||||||
_isStopped = false;
|
_isStopped = false;
|
||||||
|
|
||||||
if (_mgrJob == null) {
|
if (_mgrJob == null) {
|
||||||
_mgrJob = new ClientTunnelPoolManagerJob(_context, _pool, this);
|
_mgrJob = new ClientTunnelPoolManagerJob(_context, _pool, this);
|
||||||
_context.jobQueue().addJob(_mgrJob);
|
_context.jobQueue().addJob(_mgrJob);
|
||||||
|
} else {
|
||||||
|
_mgrJob.getTiming().setStartAfter(_context.clock().now());
|
||||||
|
_context.jobQueue().addJob(_mgrJob);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_leaseMgrJob == null) {
|
if (_leaseMgrJob == null) {
|
||||||
_leaseMgrJob = new ClientLeaseSetManagerJob(_context, this);
|
_leaseMgrJob = new ClientLeaseSetManagerJob(_context, this);
|
||||||
_context.jobQueue().addJob(_leaseMgrJob);
|
_context.jobQueue().addJob(_leaseMgrJob);
|
||||||
} else {
|
} else {
|
||||||
// we just restarted, so make sure we ask for a new leaseSet ASAP
|
// 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.forceRequestLease();
|
||||||
_leaseMgrJob.getTiming().setStartAfter(_context.clock().now());
|
_leaseMgrJob.getTiming().setStartAfter(_context.clock().now());
|
||||||
_context.jobQueue().addJob(_leaseMgrJob);
|
_context.jobQueue().addJob(_leaseMgrJob);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tunnelExpirationJob == null) {
|
if (_tunnelExpirationJob == null) {
|
||||||
_tunnelExpirationJob = new ClientTunnelPoolExpirationJob(_context, this, _pool);
|
_tunnelExpirationJob = new ClientTunnelPoolExpirationJob(_context, this, _pool);
|
||||||
_context.jobQueue().addJob(_tunnelExpirationJob);
|
_context.jobQueue().addJob(_tunnelExpirationJob);
|
||||||
}
|
} else {
|
||||||
|
_tunnelExpirationJob.getTiming().setStartAfter(_context.clock().now());
|
||||||
|
_context.jobQueue().addJob(_tunnelExpirationJob);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void stopPool() { _isStopped = true; }
|
public void stopPool() { _isStopped = true; }
|
||||||
public boolean isStopped() { return _isStopped; }
|
public boolean isStopped() { return _isStopped; }
|
||||||
|
@ -130,8 +130,12 @@ public class PoolingTunnelManagerFacade implements TunnelManagerFacade {
|
|||||||
public void createTunnels(Destination destination, ClientTunnelSettings clientSettings, long timeoutMs) {
|
public void createTunnels(Destination destination, ClientTunnelSettings clientSettings, long timeoutMs) {
|
||||||
ClientTunnelPool pool = _pool.getClientPool(destination);
|
ClientTunnelPool pool = _pool.getClientPool(destination);
|
||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("createTunnels for destination " + destination.calculateHash().toBase64() + " where the client pool exists");
|
||||||
pool.setClientSettings(clientSettings);
|
pool.setClientSettings(clientSettings);
|
||||||
} else {
|
} 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);
|
_pool.createClientPool(destination, clientSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user