* Bandwidth refiller: Reinitialize at restart, avoid

issues from clock skews
This commit is contained in:
zzz
2011-09-29 13:19:08 +00:00
parent 273e940fa1
commit efaafea78e
5 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2011-09-29 zzz
* Bandwidth refiller: Reinitialize at restart, avoid
issues from clock skews
2011-09-27 kytv
* Remove exotrack.i2p from i2psnark

View File

@ -1311,6 +1311,7 @@ public class Router implements RouterClock.ClockShiftListener {
// NOTE: DisconnectMessageHandler keys off "restart"
try { _context.clientManager().shutdown("Router restart"); } catch (Throwable t) { _log.log(Log.CRIT, "Error stopping the client manager", t); }
_log.logAlways(Log.WARN, "Stopping the comm system");
_context.bandwidthLimiter().reinitialize();
try { _context.messageRegistry().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the message registry", t); }
try { _context.commSystem().restart(); } catch (Throwable t) { _log.log(Log.CRIT, "Error restarting the comm system", t); }
_log.logAlways(Log.WARN, "Stopping the tunnel manager");

View File

@ -18,10 +18,10 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 21;
public final static long BUILD = 22;
/** for example "-test" */
public final static String EXTRA = "";
public final static String EXTRA = "-rc";
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
public static void main(String args[]) {
System.out.println("I2P Router version: " + FULL_VERSION);

View File

@ -253,6 +253,7 @@ public class FIFOBandwidthLimiter {
// it changes out from under us
// This never had locks before concurrent, anyway
// FIXME wrap - change to AtomicLong or detect
int avi = _availableInbound.addAndGet((int) bytesInbound);
if (avi > _maxInbound) {
if (_log.shouldLog(Log.DEBUG))

View File

@ -110,6 +110,9 @@ public class FIFOBandwidthRefiller implements Runnable {
+ " rate in="
+ _inboundKBytesPerSecond + ", out="
+ _outboundKBytesPerSecond +")");
// clock skew
if (numMs >= REPLENISH_FREQUENCY * 50 || numMs <= 0)
numMs = REPLENISH_FREQUENCY;
if (numMs >= REPLENISH_FREQUENCY) {
long inboundToAdd = (1024*_inboundKBytesPerSecond * numMs)/1000;
long outboundToAdd = (1024*_outboundKBytesPerSecond * numMs)/1000;