forked from I2P_Developers/i2p.i2p
log tweaks, final
This commit is contained in:
@@ -239,13 +239,13 @@ class ClientConnectionRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a DisconnectMessage and log with level Log.CRIT.
|
* Send a DisconnectMessage and log with level Log.ERROR.
|
||||||
* This is always bad.
|
* This is always bad.
|
||||||
* See ClientMessageEventListener.handleCreateSession()
|
* See ClientMessageEventListener.handleCreateSession()
|
||||||
* for why we don't send a SessionStatusMessage when we do this.
|
* for why we don't send a SessionStatusMessage when we do this.
|
||||||
*/
|
*/
|
||||||
void disconnectClient(String reason) {
|
void disconnectClient(String reason) {
|
||||||
disconnectClient(reason, Log.CRIT);
|
disconnectClient(reason, Log.ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -254,9 +254,10 @@ class ClientConnectionRunner {
|
|||||||
*/
|
*/
|
||||||
void disconnectClient(String reason, int logLevel) {
|
void disconnectClient(String reason, int logLevel) {
|
||||||
if (_log.shouldLog(logLevel))
|
if (_log.shouldLog(logLevel))
|
||||||
_log.log(logLevel, "Disconnecting the client ("
|
_log.log(logLevel, "Disconnecting the client - "
|
||||||
+ _config
|
+ reason
|
||||||
+ ") : " + reason);
|
+ " config: "
|
||||||
|
+ _config);
|
||||||
DisconnectMessage msg = new DisconnectMessage();
|
DisconnectMessage msg = new DisconnectMessage();
|
||||||
msg.setReason(reason);
|
msg.setReason(reason);
|
||||||
try {
|
try {
|
||||||
|
@@ -27,13 +27,13 @@ import net.i2p.util.Log;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class RequestLeaseSetJob extends JobImpl {
|
class RequestLeaseSetJob extends JobImpl {
|
||||||
private Log _log;
|
private final Log _log;
|
||||||
private ClientConnectionRunner _runner;
|
private final ClientConnectionRunner _runner;
|
||||||
private LeaseSet _ls;
|
private final LeaseSet _ls;
|
||||||
private long _expiration;
|
private final long _expiration;
|
||||||
private Job _onCreate;
|
private final Job _onCreate;
|
||||||
private Job _onFail;
|
private final Job _onFail;
|
||||||
private LeaseRequestState _requestState;
|
private final LeaseRequestState _requestState;
|
||||||
|
|
||||||
public RequestLeaseSetJob(RouterContext ctx, ClientConnectionRunner runner, LeaseSet set, long expiration, Job onCreate, Job onFail, LeaseRequestState state) {
|
public RequestLeaseSetJob(RouterContext ctx, ClientConnectionRunner runner, LeaseSet set, long expiration, Job onCreate, Job onFail, LeaseRequestState state) {
|
||||||
super(ctx);
|
super(ctx);
|
||||||
@@ -92,8 +92,8 @@ class RequestLeaseSetJob extends JobImpl {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class CheckLeaseRequestStatus extends JobImpl {
|
private class CheckLeaseRequestStatus extends JobImpl {
|
||||||
private LeaseRequestState _req;
|
private final LeaseRequestState _req;
|
||||||
private long _start;
|
private final long _start;
|
||||||
|
|
||||||
public CheckLeaseRequestStatus(RouterContext enclosingContext, LeaseRequestState state) {
|
public CheckLeaseRequestStatus(RouterContext enclosingContext, LeaseRequestState state) {
|
||||||
super(enclosingContext);
|
super(enclosingContext);
|
||||||
@@ -114,9 +114,9 @@ class RequestLeaseSetJob extends JobImpl {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
RequestLeaseSetJob.CheckLeaseRequestStatus.this.getContext().statManager().addRateData("client.requestLeaseSetTimeout", 1, 0);
|
RequestLeaseSetJob.CheckLeaseRequestStatus.this.getContext().statManager().addRateData("client.requestLeaseSetTimeout", 1, 0);
|
||||||
if (_log.shouldLog(Log.CRIT)) {
|
if (_log.shouldLog(Log.ERROR)) {
|
||||||
long waited = System.currentTimeMillis() - _start;
|
long waited = System.currentTimeMillis() - _start;
|
||||||
_log.log(Log.CRIT, "Failed to receive a leaseSet in the time allotted (" + waited + "): " + _req + " for "
|
_log.error("Failed to receive a leaseSet in the time allotted (" + waited + "): " + _req + " for "
|
||||||
+ _runner.getConfig().getDestination().calculateHash().toBase64());
|
+ _runner.getConfig().getDestination().calculateHash().toBase64());
|
||||||
}
|
}
|
||||||
_runner.disconnectClient("Took too long to request leaseSet");
|
_runner.disconnectClient("Took too long to request leaseSet");
|
||||||
|
Reference in New Issue
Block a user