forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head 59d72ad41332fbcf2829c85f6b3e38aaca9ee528)
to branch 'i2p.i2p.zzz.android' (head f7e9a993c660229cca575d26a0ba06eea36cea8e)
This commit is contained in:
@@ -24,7 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
|
||||
@@ -32,7 +31,7 @@ import net.i2p.I2PAppContext;
|
||||
* TimerTask that checks for good/bad up/downloader. Works together
|
||||
* with the PeerCoordinator to select which Peers get (un)choked.
|
||||
*/
|
||||
class PeerCheckerTask extends TimerTask
|
||||
class PeerCheckerTask implements Runnable
|
||||
{
|
||||
private static final long KILOPERSECOND = 1024*(PeerCoordinator.CHECK_PERIOD/1000);
|
||||
|
||||
@@ -54,8 +53,6 @@ class PeerCheckerTask extends TimerTask
|
||||
List<Peer> peerList = coordinator.peerList();
|
||||
if (peerList.isEmpty() || coordinator.halted()) {
|
||||
coordinator.setRateHistory(0, 0);
|
||||
if (coordinator.halted())
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,6 @@
|
||||
package org.klomp.snark;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
|
||||
@@ -29,7 +28,7 @@ import net.i2p.data.DataHelper;
|
||||
* TimerTask that monitors the peers and total up/download speeds.
|
||||
* Works together with the main Snark class to report periodical statistics.
|
||||
*/
|
||||
class PeerMonitorTask extends TimerTask
|
||||
class PeerMonitorTask implements Runnable
|
||||
{
|
||||
final static long MONITOR_PERIOD = 10 * 1000; // Ten seconds.
|
||||
private static final long KILOPERSECOND = 1024 * (MONITOR_PERIOD / 1000);
|
||||
|
@@ -32,8 +32,6 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.client.streaming.I2PServerSocket;
|
||||
|
@@ -48,14 +48,14 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
private final Object _addSnarkLock;
|
||||
private /* FIXME final FIXME */ File _configFile;
|
||||
private Properties _config;
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
private final I2PAppContext _context;
|
||||
private final Log _log;
|
||||
private final List _messages;
|
||||
private I2PSnarkUtil _util;
|
||||
private final I2PSnarkUtil _util;
|
||||
private PeerCoordinatorSet _peerCoordinatorSet;
|
||||
private ConnectionAcceptor _connectionAcceptor;
|
||||
private Thread _monitor;
|
||||
private boolean _running;
|
||||
private volatile boolean _running;
|
||||
|
||||
public static final String PROP_I2CP_HOST = "i2psnark.i2cpHost";
|
||||
public static final String PROP_I2CP_PORT = "i2psnark.i2cpPort";
|
||||
@@ -1089,7 +1089,7 @@ public class SnarkManager implements Snark.CompleteListener {
|
||||
// although the user will see the default until then
|
||||
getBWLimit();
|
||||
boolean doMagnets = true;
|
||||
while (true) {
|
||||
while (_running) {
|
||||
File dir = getDataDir();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Directory Monitor loop over " + dir.getAbsolutePath());
|
||||
|
Reference in New Issue
Block a user