i2psnark: Enhancements to support RPC plugin

This commit is contained in:
zzz
2017-03-20 16:41:04 +00:00
parent 05aef9bd59
commit 95b6bd36e5
6 changed files with 117 additions and 6 deletions

View File

@@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicInteger;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PServerSocket;
@@ -238,7 +239,8 @@ public class Snark
// String indicating main activity
private volatile String activity = "Not started";
private final long savedUploaded;
private static final AtomicInteger __RPCID = new AtomicInteger();
private final int _rpcID = __RPCID.incrementAndGet();
/**
* from main() via parseArguments() single torrent
@@ -1364,4 +1366,13 @@ public class Snark
long limit = 1024l * _util.getMaxUpBW();
return total > limit;
}
/**
* A unique ID for this torrent, useful for RPC
* @return positive value unless you wrap around
* @since 0.9.30
*/
public int getRPCID() {
return _rpcID;
}
}