cleanups
This commit is contained in:
@ -8,6 +8,7 @@ package net.i2p.client;
|
|||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.data.i2cp.I2CPMessage;
|
import net.i2p.data.i2cp.I2CPMessage;
|
||||||
import net.i2p.data.i2cp.BandwidthLimitsMessage;
|
import net.i2p.data.i2cp.BandwidthLimitsMessage;
|
||||||
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle I2CP BW replies from the router
|
* Handle I2CP BW replies from the router
|
||||||
@ -18,7 +19,8 @@ class BWLimitsMessageHandler extends HandlerImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Handle message " + message);
|
||||||
BandwidthLimitsMessage msg = (BandwidthLimitsMessage) message;
|
BandwidthLimitsMessage msg = (BandwidthLimitsMessage) message;
|
||||||
((I2PSimpleSession)session).bwReceived(msg.getLimits());
|
((I2PSimpleSession)session).bwReceived(msg.getLimits());
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ package net.i2p.client;
|
|||||||
import net.i2p.I2PAppContext;
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.data.i2cp.I2CPMessage;
|
import net.i2p.data.i2cp.I2CPMessage;
|
||||||
import net.i2p.data.i2cp.DestReplyMessage;
|
import net.i2p.data.i2cp.DestReplyMessage;
|
||||||
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle I2CP dest replies from the router
|
* Handle I2CP dest replies from the router
|
||||||
@ -18,7 +19,8 @@ class DestReplyMessageHandler extends HandlerImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Handle message " + message);
|
||||||
DestReplyMessage msg = (DestReplyMessage) message;
|
DestReplyMessage msg = (DestReplyMessage) message;
|
||||||
((I2PSimpleSession)session).destReceived(msg.getDestination());
|
((I2PSimpleSession)session).destReceived(msg.getDestination());
|
||||||
}
|
}
|
||||||
|
@ -42,14 +42,13 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
class I2CPMessageProducer {
|
class I2CPMessageProducer {
|
||||||
private final static Log _log = new Log(I2CPMessageProducer.class);
|
private final static Log _log = new Log(I2CPMessageProducer.class);
|
||||||
private I2PAppContext _context;
|
private final I2PAppContext _context;
|
||||||
private int _sendBps;
|
private int _sendBps;
|
||||||
private long _sendPeriodBytes;
|
private long _sendPeriodBytes;
|
||||||
private long _sendPeriodBeginTime;
|
private long _sendPeriodBeginTime;
|
||||||
|
|
||||||
public I2CPMessageProducer(I2PAppContext context) {
|
public I2CPMessageProducer(I2PAppContext context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
_sendBps = 0;
|
|
||||||
context.statManager().createRateStat("client.sendBpsRaw", "How fast we pump out I2CP data messages", "ClientMessages", new long[] { 60*1000, 5*60*1000, 10*60*1000, 60*60*1000 });
|
context.statManager().createRateStat("client.sendBpsRaw", "How fast we pump out I2CP data messages", "ClientMessages", new long[] { 60*1000, 5*60*1000, 10*60*1000, 60*60*1000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ package net.i2p.client;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import net.i2p.I2PException;
|
import net.i2p.I2PException;
|
||||||
import net.i2p.util.Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when there is a problem doing something on the session
|
* Thrown when there is a problem doing something on the session
|
||||||
@ -18,7 +17,6 @@ import net.i2p.util.Log;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class I2PSessionException extends I2PException {
|
public class I2PSessionException extends I2PException {
|
||||||
private final static Log _log = new Log(I2PSessionException.class);
|
|
||||||
|
|
||||||
public I2PSessionException(String msg, Throwable t) {
|
public I2PSessionException(String msg, Throwable t) {
|
||||||
super(msg, t);
|
super(msg, t);
|
||||||
@ -27,4 +25,4 @@ public class I2PSessionException extends I2PException {
|
|||||||
public I2PSessionException(String msg) {
|
public I2PSessionException(String msg) {
|
||||||
super(msg);
|
super(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import net.i2p.I2PAppContext;
|
|||||||
import net.i2p.data.i2cp.I2CPMessage;
|
import net.i2p.data.i2cp.I2CPMessage;
|
||||||
import net.i2p.data.i2cp.SetDateMessage;
|
import net.i2p.data.i2cp.SetDateMessage;
|
||||||
import net.i2p.util.Clock;
|
import net.i2p.util.Clock;
|
||||||
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle I2CP time messages from the router
|
* Handle I2CP time messages from the router
|
||||||
@ -25,7 +26,8 @@ class SetDateMessageHandler extends HandlerImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||||
_log.debug("Handle message " + message);
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
_log.debug("Handle message " + message);
|
||||||
SetDateMessage msg = (SetDateMessage) message;
|
SetDateMessage msg = (SetDateMessage) message;
|
||||||
// Only do this if we are NOT in the router context;
|
// Only do this if we are NOT in the router context;
|
||||||
// otherwise, it sets getUpdatedSuccessfully() in Clock when all
|
// otherwise, it sets getUpdatedSuccessfully() in Clock when all
|
||||||
|
Reference in New Issue
Block a user