From 37716f34de3193a33c00956a4bdb0c6fe9b80266 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 18 Jul 2012 11:52:20 +0000 Subject: [PATCH] * i2psnark: Clear rate stats when restarting torrent --- .../i2psnark/java/src/org/klomp/snark/PeerCoordinator.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java index 8ded86247b..92aab6df0a 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java @@ -22,6 +22,7 @@ package org.klomp.snark; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; @@ -438,6 +439,12 @@ class PeerCoordinator implements PeerListener */ public void restart() { halted = false; + synchronized (uploaded_old) { + Arrays.fill(uploaded_old, 0); + } + synchronized (downloaded_old) { + Arrays.fill(downloaded_old, 0); + } timer.schedule((CHECK_PERIOD / 2) + _random.nextInt((int) CHECK_PERIOD)); } -- GitLab