diff --git a/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java b/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java index 5c8ec1bf1f..d97fb5a9a1 100644 --- a/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java +++ b/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java @@ -359,7 +359,7 @@ public abstract class AbstractTrafficShapingHandler extends // Time is too short, so just lets continue return 0; } - return bytes * 1000 / limit - interval; + return ((bytes * 1000 / limit - interval)/10)*10; } @Override diff --git a/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java b/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java index 6976ac08c5..d8cfdb3fb6 100644 --- a/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java +++ b/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java @@ -248,9 +248,10 @@ public class TrafficCounter { * @param newcheckInterval */ public void configure(long newcheckInterval) { - if (checkInterval.get() != newcheckInterval) { - checkInterval.set(newcheckInterval); - if (newcheckInterval <= 0) { + long newInterval = (newcheckInterval/10)*10; + if (checkInterval.get() != newInterval) { + checkInterval.set(newInterval); + if (newInterval <= 0) { stop(); // No more active monitoring lastTime.set(System.currentTimeMillis());