forked from I2P_Developers/i2p.i2p
remove unused local variables (eclipse)
This commit is contained in:
@@ -400,7 +400,7 @@ public class DoCMDS implements Runnable {
|
||||
*/
|
||||
private boolean is64ok(String data) {
|
||||
try {
|
||||
Destination x = new Destination(data);
|
||||
new Destination(data);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
|
||||
@@ -59,9 +59,7 @@ class PeerCheckerTask implements Runnable
|
||||
long worstdownload = Long.MAX_VALUE;
|
||||
Peer worstDownloader = null;
|
||||
|
||||
int peers = 0;
|
||||
int uploaders = 0;
|
||||
int downloaders = 0;
|
||||
int removedCount = 0;
|
||||
|
||||
long uploaded = 0;
|
||||
@@ -84,12 +82,8 @@ class PeerCheckerTask implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
peers++;
|
||||
|
||||
if (!peer.isChoking())
|
||||
uploaders++;
|
||||
if (!peer.isChoked() && peer.isInteresting())
|
||||
downloaders++;
|
||||
|
||||
long upload = peer.getUploaded();
|
||||
uploaded += upload;
|
||||
|
||||
@@ -315,8 +315,6 @@ public class Snark
|
||||
id = generateID();
|
||||
debug("My peer id: " + PeerID.idencode(id), Snark.INFO);
|
||||
|
||||
int port;
|
||||
IOException lastException = null;
|
||||
/*
|
||||
* Don't start a tunnel if the torrent isn't going to be started.
|
||||
* If we are starting,
|
||||
|
||||
@@ -198,8 +198,6 @@ public class TrackerClient extends I2PAppThread
|
||||
long left = coordinator.getLeft();
|
||||
|
||||
boolean completed = (left == 0);
|
||||
int sleptTime = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if (!verifyConnected()) return;
|
||||
@@ -258,8 +256,6 @@ public class TrackerClient extends I2PAppThread
|
||||
event = NO_EVENT;
|
||||
|
||||
// *** loop once for each tracker
|
||||
// Only do a request when necessary.
|
||||
sleptTime = 0;
|
||||
int maxSeenPeers = 0;
|
||||
for (Iterator iter = trackers.iterator(); iter.hasNext(); ) {
|
||||
Tracker tr = (Tracker)iter.next();
|
||||
@@ -308,7 +304,6 @@ public class TrackerClient extends I2PAppThread
|
||||
// only delay if we actually make an attempt to add peer
|
||||
if(coordinator.addPeer(cur) && it.hasNext()) {
|
||||
int delay = (DELAY_MUL * r.nextInt(10)) + DELAY_MIN;
|
||||
sleptTime += delay;
|
||||
try { Thread.sleep(delay); } catch (InterruptedException ie) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,6 @@ public class I2PSnarkServlet extends DefaultServlet {
|
||||
// return;
|
||||
//}
|
||||
if ("Add".equals(action)) {
|
||||
String newFile = req.getParameter("newFile");
|
||||
String newURL = req.getParameter("newURL");
|
||||
/******
|
||||
// NOTE - newFile currently disabled in HTML form - see below
|
||||
|
||||
@@ -176,7 +176,6 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
in = s.getInputStream();
|
||||
String line, method = null, host = null, destination = null, restofline = null;
|
||||
StringBuilder newRequest = new StringBuilder();
|
||||
int ahelper = 0;
|
||||
String authorization = null;
|
||||
while (true) {
|
||||
// Use this rather than BufferedReader because we can't have readahead,
|
||||
|
||||
@@ -320,7 +320,6 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
public static final String PROP_DISABLE_HELPER = "i2ptunnel.httpclient.disableAddressHelper";
|
||||
|
||||
protected void clientConnectionRun(Socket s) {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
|
||||
/**
|
||||
@@ -941,7 +940,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
I2PSocket i2ps = createI2PSocket(clientDest, getDefaultOptions(opts));
|
||||
byte[] data = newRequest.toString().getBytes("ISO-8859-1");
|
||||
Runnable onTimeout = new OnTimeout(s, s.getOutputStream(), targetRequest, usingWWWProxy, currentProxy, requestId);
|
||||
I2PTunnelRunner runner = new I2PTunnelHTTPClientRunner(s, i2ps, sockLock, data, mySockets, onTimeout);
|
||||
new I2PTunnelHTTPClientRunner(s, i2ps, sockLock, data, mySockets, onTimeout);
|
||||
} catch (SocketException ex) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(getPrefix(requestId) + "Error trying to connect", ex);
|
||||
|
||||
@@ -131,7 +131,6 @@ public class SOCKS4aServer extends SOCKSServer {
|
||||
}
|
||||
|
||||
protected void confirmConnection() throws SOCKSException {
|
||||
DataInputStream in;
|
||||
DataOutputStream out;
|
||||
try {
|
||||
out = new DataOutputStream(clientSock.getOutputStream());
|
||||
|
||||
@@ -97,7 +97,6 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
*/
|
||||
private void init(DataInputStream in, DataOutputStream out) throws IOException, SOCKSException {
|
||||
int nMethods = in.readUnsignedByte();
|
||||
boolean methodOk = false;
|
||||
int method = Method.NO_ACCEPTABLE_METHODS;
|
||||
|
||||
for (int i = 0; i < nMethods; ++i) {
|
||||
@@ -247,7 +246,6 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
}
|
||||
|
||||
protected void confirmConnection() throws SOCKSException {
|
||||
DataInputStream in;
|
||||
DataOutputStream out;
|
||||
try {
|
||||
out = new DataOutputStream(clientSock.getOutputStream());
|
||||
|
||||
@@ -91,11 +91,10 @@ import net.i2p.util.EventDispatcher;
|
||||
|
||||
// create i2pclient and destination
|
||||
I2PClient client = I2PClientFactory.createClient();
|
||||
Destination destN;
|
||||
byte[] key;
|
||||
try {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream(512);
|
||||
destN = client.createDestination(out);
|
||||
client.createDestination(out);
|
||||
key = out.toByteArray();
|
||||
} catch(Exception exc) {
|
||||
throw new RuntimeException("failed to create i2p-destination", exc);
|
||||
|
||||
@@ -262,7 +262,6 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
private void saveWebAppChanges() {
|
||||
Properties props = RouterConsoleRunner.webAppProperties();
|
||||
Set keys = props.keySet();
|
||||
int cur = 0;
|
||||
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
|
||||
String name = (String)iter.next();
|
||||
if (! (name.startsWith(RouterConsoleRunner.PREFIX) && name.endsWith(RouterConsoleRunner.ENABLED)))
|
||||
@@ -279,7 +278,6 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
private void savePluginChanges() {
|
||||
Properties props = PluginStarter.pluginProperties();
|
||||
Set keys = props.keySet();
|
||||
int cur = 0;
|
||||
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
|
||||
String name = (String)iter.next();
|
||||
if (! (name.startsWith(PluginStarter.PREFIX) && name.endsWith(PluginStarter.ENABLED)))
|
||||
|
||||
@@ -67,7 +67,6 @@ class ProfileOrganizerRenderer {
|
||||
int fast = 0;
|
||||
int reliable = 0;
|
||||
int integrated = 0;
|
||||
int failing = 0;
|
||||
StringBuilder buf = new StringBuilder(16*1024);
|
||||
buf.append("<h2>").append(_("Peer Profiles")).append("</h2>\n<p>");
|
||||
buf.append(ngettext("Showing 1 recent profile.", "Showing {0} recent profiles.", order.size())).append('\n');
|
||||
@@ -101,7 +100,6 @@ class ProfileOrganizerRenderer {
|
||||
tier = 2;
|
||||
reliable++;
|
||||
} else if (_organizer.isFailing(peer)) {
|
||||
failing++;
|
||||
} else {
|
||||
tier = 3;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,6 @@ public class StatsGenerator {
|
||||
long numPeriods = curRate.getLifetimePeriods();
|
||||
if (numPeriods > 0) {
|
||||
double avgFrequency = curRate.getLifetimeEventCount() / (double)numPeriods;
|
||||
double peakFrequency = curRate.getExtremeEventCount();
|
||||
buf.append(" (").append(_("Average event count")).append(": ");
|
||||
buf.append(num(avgFrequency));
|
||||
buf.append("; ").append(_("Events in peak period")).append(": ");
|
||||
|
||||
@@ -141,7 +141,6 @@ class SummaryListener implements RateSummaryListener {
|
||||
long heartbeat = period*10/1000;
|
||||
def.addDatasource(_name, "GAUGE", heartbeat, Double.NaN, Double.NaN);
|
||||
def.addDatasource(_eventName, "GAUGE", heartbeat, 0, Double.NaN);
|
||||
int steps = 1;
|
||||
if (_isPersistent) {
|
||||
_rows = (int) Math.max(MIN_ROWS, Math.min(MAX_ROWS, THREE_MONTHS / period));
|
||||
} else {
|
||||
|
||||
@@ -151,7 +151,7 @@ public class SAMUtils {
|
||||
* @return Properties with the parsed SAM params
|
||||
*/
|
||||
public static Properties parseParams(StringTokenizer tok) throws SAMException {
|
||||
int pos, nprops = 0, ntoks = tok.countTokens();
|
||||
int pos, ntoks = tok.countTokens();
|
||||
String token, param;
|
||||
Properties props = new Properties();
|
||||
|
||||
@@ -175,7 +175,6 @@ public class SAMUtils {
|
||||
|
||||
props.setProperty(param, value.toString());
|
||||
value.setLength(0);
|
||||
nprops += 1;
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
|
||||
@@ -307,10 +307,7 @@ class Connection {
|
||||
packet.setFlag(Packet.FLAG_SIGNATURE_REQUESTED);
|
||||
}
|
||||
|
||||
boolean ackOnly = false;
|
||||
|
||||
if ( (packet.getSequenceNum() == 0) && (!packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) ) {
|
||||
ackOnly = true;
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("No resend for " + packet);
|
||||
} else {
|
||||
|
||||
@@ -335,11 +335,9 @@ class MessageInputStream extends InputStream {
|
||||
ByteArray cur = _readyDataBlocks.get(0);
|
||||
byte rv = cur.getData()[cur.getOffset()+_readyDataBlockIndex];
|
||||
_readyDataBlockIndex++;
|
||||
boolean removed = false;
|
||||
if (cur.getValid() <= _readyDataBlockIndex) {
|
||||
_readyDataBlockIndex = 0;
|
||||
_readyDataBlocks.remove(0);
|
||||
removed = true;
|
||||
}
|
||||
_readTotal++;
|
||||
target[offset + i] = rv; // rv < 0 ? rv + 256 : rv
|
||||
|
||||
@@ -270,7 +270,6 @@ class Packet {
|
||||
//_payload = null;
|
||||
}
|
||||
public ByteArray acquirePayload() {
|
||||
ByteArray old = _payload;
|
||||
_payload = new ByteArray(new byte[Packet.MAX_PAYLOAD_SIZE]);
|
||||
return _payload;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,6 @@ public class Base64 implements Encoding {
|
||||
}
|
||||
|
||||
private static byte decodeByte( byte b ) throws DecodingException {
|
||||
byte a = b;
|
||||
if( b >= 'A' && b <= 'Z' )
|
||||
b -= 'A';
|
||||
else if( b >= 'a' && b <= 'z' )
|
||||
|
||||
@@ -70,7 +70,6 @@ public class QuotedPrintable implements Encoding {
|
||||
private static int BUFSIZE = 2;
|
||||
private String encode( InputStream in ) throws EncodingException, IOException {
|
||||
StringBuilder out = new StringBuilder();
|
||||
int l = 0;
|
||||
int read = 0, buffered = 0, tmp[] = new int[BUFSIZE];
|
||||
while( true ) {
|
||||
read = in.available();
|
||||
@@ -88,7 +87,6 @@ public class QuotedPrintable implements Encoding {
|
||||
|
||||
if( c > 32 && c < 127 && c != 61 ) {
|
||||
out.append( (char)c );
|
||||
l++;
|
||||
}
|
||||
else if( ( c == 32 || c == 9 ) ) {
|
||||
if( buffered > 0 && ( tmp[0] == 10 || tmp[0] == 13 ) ) {
|
||||
@@ -96,11 +94,9 @@ public class QuotedPrintable implements Encoding {
|
||||
* whitespace at end of line
|
||||
*/
|
||||
out.append( c == 32 ? "=20" : "=09" );
|
||||
l += 3;
|
||||
}
|
||||
else {
|
||||
out.append( (char)c );
|
||||
l++;
|
||||
}
|
||||
}
|
||||
else if( c == 13 && buffered > 0 && tmp[0] == 10 ) {
|
||||
@@ -108,14 +104,12 @@ public class QuotedPrintable implements Encoding {
|
||||
buffered--;
|
||||
for( int j = 1; j < BUFSIZE; j++ )
|
||||
tmp[j-1] = tmp[j];
|
||||
l = 0;
|
||||
}
|
||||
else {
|
||||
if( c < 0 || c > 255 ) {
|
||||
throw new EncodingException( "Encoding supports only values of 0..255." );
|
||||
}
|
||||
out.append( HexTable.table[ c ] );
|
||||
l += 3;
|
||||
}
|
||||
}
|
||||
return out.toString();
|
||||
|
||||
@@ -100,7 +100,7 @@ class MessageState {
|
||||
}
|
||||
|
||||
public void waitFor(int status, long expiration) {
|
||||
long checkTime = -1;
|
||||
//long checkTime = -1;
|
||||
boolean found = false;
|
||||
while (!found) {
|
||||
if (_cancelled) return;
|
||||
@@ -112,13 +112,13 @@ class MessageState {
|
||||
}
|
||||
found = false;
|
||||
synchronized (_receivedStatus) {
|
||||
long beforeCheck = _context.clock().now();
|
||||
//long beforeCheck = _context.clock().now();
|
||||
if (locked_isSuccess(status) || locked_isFailure(status)) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_prefix + "Received a confirm (one way or the other)");
|
||||
found = true;
|
||||
}
|
||||
checkTime = _context.clock().now() - beforeCheck;
|
||||
//checkTime = _context.clock().now() - beforeCheck;
|
||||
if (!found) {
|
||||
if (timeToWait > 5000) {
|
||||
timeToWait = 5000;
|
||||
|
||||
@@ -27,7 +27,6 @@ class MessageStatusMessageHandler extends HandlerImpl {
|
||||
}
|
||||
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
boolean skipStatus = true;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Handle message " + message);
|
||||
MessageStatusMessage msg = (MessageStatusMessage) message;
|
||||
|
||||
@@ -61,8 +61,6 @@ public final class I2PDatagramDissector {
|
||||
*/
|
||||
public void loadI2PDatagram(byte[] dgram) throws DataFormatException {
|
||||
ByteArrayInputStream dgStream = new ByteArrayInputStream(dgram);
|
||||
byte[] rxTrimmedPayload;
|
||||
|
||||
// set invalid(very important!)
|
||||
this.valid = false;
|
||||
|
||||
|
||||
@@ -89,8 +89,6 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
//...........................................................................
|
||||
|
||||
static {
|
||||
long time = Clock.getInstance().now();
|
||||
|
||||
if (_RDEBUG && _debuglevel > 6) {
|
||||
System.out.println("Algorithm Name: Rijndael ver 0.1");
|
||||
System.out.println("Electronic Codebook (ECB) Mode");
|
||||
|
||||
@@ -318,7 +318,6 @@ public class ElGamalAESEngine {
|
||||
//_log.debug("Hash of entire aes block after decryption: \n" + DataHelper.toString(h.getData(), 32));
|
||||
try {
|
||||
SessionKey newKey = null;
|
||||
Hash readHash = null;
|
||||
List tags = null;
|
||||
|
||||
//ByteArrayInputStream bais = new ByteArrayInputStream(decrypted);
|
||||
|
||||
@@ -520,10 +520,9 @@ public class Base64 {
|
||||
// + ((len % 3) > 0 ? 4 : 0) // Account for padding
|
||||
// + (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)]; // New lines
|
||||
int d = 0;
|
||||
int e = 0;
|
||||
int len2 = len - 2;
|
||||
int lineLength = 0;
|
||||
for (; d < len2; d += 3, e += 4) {
|
||||
for (; d < len2; d += 3) {
|
||||
//encode3to4(source, d + off, 3, outBuff, e);
|
||||
encode3to4(source, d + off, 3, out, alpha);
|
||||
|
||||
@@ -531,7 +530,6 @@ public class Base64 {
|
||||
if (breakLines && lineLength == MAX_LINE_LENGTH) {
|
||||
//outBuff[e + 4] = NEW_LINE;
|
||||
out.append('\n');
|
||||
e++;
|
||||
lineLength = 0;
|
||||
} // end if: end of line
|
||||
} // en dfor: each piece of array
|
||||
@@ -539,7 +537,6 @@ public class Base64 {
|
||||
if (d < len) {
|
||||
//encode3to4(source, d + off, len - d, outBuff, e);
|
||||
encode3to4(source, d + off, len - d, out, alpha);
|
||||
e += 4;
|
||||
} // end if: some padding needed
|
||||
|
||||
//out.append(new String(outBuff, 0, e));
|
||||
|
||||
@@ -212,8 +212,7 @@ public class FileUtil {
|
||||
}
|
||||
try {
|
||||
InputStream in = zip.getInputStream(entry);
|
||||
int read = 0;
|
||||
while ( (read = in.read(buf)) != -1) {
|
||||
while ( (in.read(buf)) != -1) {
|
||||
// throw the data away
|
||||
}
|
||||
//System.err.println("INFO: File [" + entry.getName() + "] extracted");
|
||||
|
||||
@@ -333,7 +333,6 @@ public class LogManager {
|
||||
_fileSize = getFileSize(config.getProperty(PROP_FILESIZE, DEFAULT_FILESIZE));
|
||||
_rotationLimit = -1;
|
||||
try {
|
||||
String str = config.getProperty(PROP_ROTATIONLIMIT);
|
||||
_rotationLimit = Integer.parseInt(config.getProperty(PROP_ROTATIONLIMIT, DEFAULT_ROTATIONLIMIT));
|
||||
} catch (NumberFormatException nfe) {
|
||||
System.err.println("Invalid rotation limit");
|
||||
@@ -521,14 +520,12 @@ public class LogManager {
|
||||
private void updateLimit(Log log) {
|
||||
List<LogLimit> limits = getLimits(log);
|
||||
LogLimit max = null;
|
||||
LogLimit notMax = null;
|
||||
if (limits != null) {
|
||||
for (LogLimit cur : limits) {
|
||||
if (max == null)
|
||||
max = cur;
|
||||
else {
|
||||
if (cur.getRootName().length() > max.getRootName().length()) {
|
||||
notMax = max;
|
||||
max = cur;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,10 +103,8 @@ public class ShellCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String streamData;
|
||||
|
||||
try {
|
||||
while ((streamData = bufferedReader.readLine()) != null) {
|
||||
while ((bufferedReader.readLine()) != null) {
|
||||
// Just like a Hoover.
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -164,7 +164,6 @@ public class BSkipSpan extends SkipSpan {
|
||||
if (nKeys <= 0 && prev != null)
|
||||
bf.log.error("Flushing with no entries?" + this, new Exception());
|
||||
|
||||
int ksz, vsz;
|
||||
int curPage = this.page;
|
||||
int[] curNextPage = new int[1];
|
||||
curNextPage[0] = this.overflowPage;
|
||||
|
||||
@@ -91,7 +91,6 @@ public class IBSkipIterator extends SkipIterator {
|
||||
*/
|
||||
@Override
|
||||
public Comparable nextKey() {
|
||||
Comparable c;
|
||||
if(index < ss.nKeys) {
|
||||
if (ss.keys == null) {
|
||||
try {
|
||||
|
||||
@@ -84,7 +84,6 @@ public class SkipIterator implements ListIterator {
|
||||
* @throws NoSuchElementException
|
||||
*/
|
||||
public Comparable nextKey() {
|
||||
Comparable c;
|
||||
if(index < ss.nKeys) { return ss.keys[index]; }
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ class JobQueueRunner implements Runnable {
|
||||
public void run() {
|
||||
//_state = 2;
|
||||
long lastActive = _context.clock().now();
|
||||
long jobNum = 0;
|
||||
while ( (_keepRunning) && (_context.jobQueue().isAlive()) ) {
|
||||
//_state = 3;
|
||||
try {
|
||||
@@ -69,7 +68,6 @@ class JobQueueRunner implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
long betweenJobs = now - lastActive;
|
||||
_currentJob = job;
|
||||
_lastJob = null;
|
||||
//_state = 9;
|
||||
@@ -117,7 +115,6 @@ class JobQueueRunner implements Runnable {
|
||||
_lastJob = _currentJob;
|
||||
_currentJob = null;
|
||||
_lastEnd = lastActive;
|
||||
jobNum++;
|
||||
//_state = 15;
|
||||
|
||||
//if ( (jobNum % 10) == 0)
|
||||
|
||||
@@ -71,7 +71,7 @@ class ExpireRoutersJob extends JobImpl {
|
||||
// no need to impose our own expiration here.
|
||||
// One issue is this will queue a ton of floodfill queries the first time it is run
|
||||
// after the 1h router startup grace period.
|
||||
RouterInfo ri = _facade.lookupRouterInfoLocally(key);
|
||||
_facade.lookupRouterInfoLocally(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +391,7 @@ class KBucketImpl implements KBucket {
|
||||
//buf.append(toString(rnd.getData())).append('\n');
|
||||
boolean ok = bucket.shouldContain(rnd);
|
||||
if (!ok) {
|
||||
byte diff[] = bucket.getLocal().cachedXor(rnd);
|
||||
//byte diff[] = bucket.getLocal().cachedXor(rnd);
|
||||
//BigInteger dv = new BigInteger(1, diff);
|
||||
//log.error("WTF! bucket doesn't want: \n" + toString(rnd.getData())
|
||||
// + "\nDelta: \n" + toString(diff) + "\nDelta val: \n" + dv.toString(2)
|
||||
@@ -427,7 +427,7 @@ class KBucketImpl implements KBucket {
|
||||
//buf.append(toString(rnd.getData())).append('\n');
|
||||
boolean ok = bucket.shouldContain(rnd);
|
||||
if (!ok) {
|
||||
byte diff[] = bucket.getLocal().cachedXor(rnd);
|
||||
//byte diff[] = bucket.getLocal().cachedXor(rnd);
|
||||
//BigInteger dv = new BigInteger(1, diff);
|
||||
//log.error("WTF! bucket doesn't want: \n" + toString(rnd.getData())
|
||||
// + "\nDelta: \n" + toString(diff) + "\nDelta val: \n" + dv.toString(2)
|
||||
|
||||
@@ -67,8 +67,6 @@ class LocalHash extends Hash {
|
||||
byte[] distance = _xorCache.get(key);
|
||||
|
||||
if (distance == null) {
|
||||
// not cached, lets cache it
|
||||
int cached = 0;
|
||||
synchronized (_xorCache) {
|
||||
int toRemove = _xorCache.size() + 1 - MAX_CACHED_XOR;
|
||||
if (toRemove > 0) {
|
||||
@@ -83,7 +81,6 @@ class LocalHash extends Hash {
|
||||
}
|
||||
distance = DataHelper.xor(key.getData(), getData());
|
||||
_xorCache.put(key, distance);
|
||||
cached = _xorCache.size();
|
||||
}
|
||||
/****
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
|
||||
@@ -653,9 +653,6 @@ class SearchJob extends JobImpl {
|
||||
TunnelInfo outTunnel = getContext().tunnelManager().selectOutboundExploratoryTunnel(to);
|
||||
|
||||
if (outTunnel != null) {
|
||||
TunnelId targetTunnelId = null; // not needed
|
||||
Job onSend = null; // not wanted
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("resending leaseSet out to " + to + " through " + outTunnel + ": " + msg);
|
||||
getContext().tunnelDispatcher().dispatchOutbound(msg, outTunnel.getSendTunnelId(0), null, to);
|
||||
|
||||
@@ -625,7 +625,6 @@ public class PeerProfile {
|
||||
System.out.println(numExpanded + "/" + numCompact + ": create array - Used: " + used + " bytes (or " + usedPer + " bytes per array entry)");
|
||||
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
try {
|
||||
for (; i < numExpanded; i++)
|
||||
profs[i] = new PeerProfile(ctx, new Hash(new byte[Hash.HASH_LENGTH]));
|
||||
|
||||
@@ -55,9 +55,6 @@ public class LoadRouterInfoJob extends JobImpl {
|
||||
private void loadRouterInfo() {
|
||||
String routerInfoFile = getContext().getProperty(Router.PROP_INFO_FILENAME, Router.PROP_INFO_FILENAME_DEFAULT);
|
||||
RouterInfo info = null;
|
||||
boolean failedRead = false;
|
||||
|
||||
|
||||
String keyFilename = getContext().getProperty(Router.PROP_KEYS_FILENAME, Router.PROP_KEYS_FILENAME_DEFAULT);
|
||||
|
||||
File rif = new File(getContext().getRouterDir(), routerInfoFile);
|
||||
|
||||
@@ -78,7 +78,6 @@ public class RebuildRouterInfoJob extends JobImpl {
|
||||
}
|
||||
void rebuildRouterInfo(boolean alreadyRunning) {
|
||||
_log.debug("Rebuilding the new router info");
|
||||
boolean fullRebuild = false;
|
||||
RouterInfo info = null;
|
||||
String infoFilename = getContext().getProperty(Router.PROP_INFO_FILENAME, Router.PROP_INFO_FILENAME_DEFAULT);
|
||||
File infoFile = new File(getContext().getRouterDir(), infoFilename);
|
||||
@@ -158,7 +157,6 @@ public class RebuildRouterInfoJob extends JobImpl {
|
||||
// this proc writes the keys and info to the file as well as builds the latest and greatest info
|
||||
CreateRouterInfoJob j = new CreateRouterInfoJob(getContext(), null);
|
||||
info = j.createRouterInfo();
|
||||
fullRebuild = true;
|
||||
}
|
||||
|
||||
//MessageHistory.initialize();
|
||||
|
||||
@@ -292,9 +292,9 @@ public abstract class TransportImpl implements Transport {
|
||||
}
|
||||
|
||||
if (log) {
|
||||
/*
|
||||
String type = msg.getMessageType();
|
||||
// the udp transport logs some further details
|
||||
/*
|
||||
_context.messageHistory().sendMessage(type, msg.getMessageId(),
|
||||
msg.getExpiration(),
|
||||
msg.getTarget().getIdentity().getHash(),
|
||||
|
||||
@@ -149,7 +149,7 @@ public class TransportManager implements TransportEventListener {
|
||||
configTransports();
|
||||
_log.debug("Starting up the transport manager");
|
||||
for (Transport t : _transports.values()) {
|
||||
RouterAddress addr = t.startListening();
|
||||
t.startListening();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Transport " + t.getStyle() + " started");
|
||||
}
|
||||
|
||||
@@ -120,7 +120,6 @@ class UPnPManager {
|
||||
_log.debug("UPnP Callback:");
|
||||
|
||||
DetectedIP[] ips = _upnp.getAddress();
|
||||
byte[] detected = null;
|
||||
if (ips != null) {
|
||||
for (DetectedIP ip : ips) {
|
||||
// store the first public one and tell the transport manager if it changed
|
||||
|
||||
@@ -501,7 +501,7 @@ class EventPumper implements Runnable {
|
||||
chan.socket().setKeepAlive(true);
|
||||
|
||||
SelectionKey ckey = chan.register(_selector, SelectionKey.OP_READ);
|
||||
NTCPConnection con = new NTCPConnection(_context, _transport, chan, ckey);
|
||||
new NTCPConnection(_context, _transport, chan, ckey);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("new NTCP connection established: " +con);
|
||||
} catch (IOException ioe) {
|
||||
|
||||
@@ -737,12 +737,6 @@ public class NTCPTransport extends TransportImpl {
|
||||
}
|
||||
long offsetTotal = 0;
|
||||
|
||||
int bpsIn = 0;
|
||||
int bpsOut = 0;
|
||||
long uptimeMsTotal = 0;
|
||||
long sendTotal = 0;
|
||||
long recvTotal = 0;
|
||||
int numPeers = 0;
|
||||
float bpsSend = 0;
|
||||
float bpsRecv = 0;
|
||||
long totalUptime = 0;
|
||||
|
||||
@@ -178,7 +178,7 @@ class ACKSender implements Runnable {
|
||||
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Sending ACK for " + ackBitfields);
|
||||
boolean ok = peer.allocateSendingBytes(ack.getPacket().getLength(), true);
|
||||
peer.allocateSendingBytes(ack.getPacket().getLength(), true);
|
||||
// ignore whether its ok or not, its a bloody ack. this should be fixed, probably.
|
||||
_transport.send(ack);
|
||||
|
||||
|
||||
@@ -496,7 +496,6 @@ class EstablishmentManager {
|
||||
private void handleCompletelyEstablished(InboundEstablishState state) {
|
||||
if (state.complete()) return;
|
||||
|
||||
long now = _context.clock().now();
|
||||
RouterIdentity remote = state.getConfirmedIdentity();
|
||||
PeerState peer = new PeerState(_context, _transport,
|
||||
state.getSentIP(), state.getSentPort(), remote.calculateHash(), true);
|
||||
@@ -1076,7 +1075,6 @@ class EstablishmentManager {
|
||||
if ( (nextSendTime == -1) || (delay > 0) ) {
|
||||
if (delay > 1000)
|
||||
delay = 1000;
|
||||
boolean interrupted = false;
|
||||
try {
|
||||
synchronized (_activityLock) {
|
||||
if (_activity > 0)
|
||||
@@ -1087,7 +1085,6 @@ class EstablishmentManager {
|
||||
_activityLock.wait(delay);
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
interrupted = true;
|
||||
}
|
||||
// if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("After waiting w/ nextSend=" + nextSendTime
|
||||
|
||||
@@ -118,7 +118,6 @@ class InboundMessageFragments /*implements UDPTransport.PartialACKSource */{
|
||||
continue;
|
||||
}
|
||||
|
||||
int size = data.readMessageFragmentSize(i);
|
||||
InboundMessageState state = null;
|
||||
boolean messageComplete = false;
|
||||
boolean messageExpired = false;
|
||||
|
||||
@@ -115,7 +115,6 @@ class MessageReceiver {
|
||||
while (_alive) {
|
||||
int expired = 0;
|
||||
long expiredLifetime = 0;
|
||||
int remaining = 0;
|
||||
try {
|
||||
while (message == null) {
|
||||
message = _completeMessages.take();
|
||||
|
||||
@@ -226,7 +226,6 @@ class PacketBuilder {
|
||||
int off = HEADER_SIZE;
|
||||
|
||||
StringBuilder msg = null;
|
||||
boolean acksIncluded = false;
|
||||
if (_log.shouldLog(Log.INFO)) {
|
||||
msg = new StringBuilder(128);
|
||||
msg.append("Data pkt to ").append(peer.getRemotePeer().toBase64());
|
||||
|
||||
@@ -1562,12 +1562,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
public int countActivePeers() {
|
||||
long now = _context.clock().now();
|
||||
int active = 0;
|
||||
int inactive = 0;
|
||||
for (Iterator<PeerState> iter = _peersByIdent.values().iterator(); iter.hasNext(); ) {
|
||||
for (Iterator<PeerState> iter = _peersByIdent.values().iterator(); iter.hasNext(); ) {
|
||||
PeerState peer = iter.next();
|
||||
if (now-peer.getLastReceiveTime() > 5*60*1000)
|
||||
inactive++;
|
||||
else
|
||||
if (now-peer.getLastReceiveTime() <= 5*60*1000)
|
||||
active++;
|
||||
}
|
||||
return active;
|
||||
@@ -1577,12 +1574,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
public int countActiveSendPeers() {
|
||||
long now = _context.clock().now();
|
||||
int active = 0;
|
||||
int inactive = 0;
|
||||
for (Iterator<PeerState> iter = _peersByIdent.values().iterator(); iter.hasNext(); ) {
|
||||
for (Iterator<PeerState> iter = _peersByIdent.values().iterator(); iter.hasNext(); ) {
|
||||
PeerState peer = iter.next();
|
||||
if (now-peer.getLastSendFullyTime() > 1*60*1000)
|
||||
inactive++;
|
||||
else
|
||||
if (now-peer.getLastSendFullyTime() <= 1*60*1000)
|
||||
active++;
|
||||
}
|
||||
return active;
|
||||
@@ -2089,9 +2083,9 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
|
||||
buf.append("<td class=\"cells\" align=\"right\">");
|
||||
long skew = peer.getClockSkew();
|
||||
buf.append(DataHelper.formatDuration2(peer.getClockSkew()));
|
||||
buf.append(DataHelper.formatDuration2(skew));
|
||||
buf.append("</td>");
|
||||
offsetTotal = offsetTotal + peer.getClockSkew();
|
||||
offsetTotal = offsetTotal + skew;
|
||||
|
||||
long sendWindow = peer.getSendWindowBytes();
|
||||
|
||||
@@ -2155,7 +2149,6 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
//buf.append(peer.getPacketRetransmissionRate());
|
||||
buf.append("</td>");
|
||||
|
||||
double recvDupPct = (double)peer.getPacketsReceivedDuplicate()/(double)peer.getPacketsReceived();
|
||||
buf.append("<td class=\"cells\" align=\"right\">");
|
||||
buf.append(dupRecv); //formatPct(recvDupPct));
|
||||
buf.append("</td>");
|
||||
|
||||
@@ -157,8 +157,6 @@ class TrivialPreprocessor implements TunnelGateway.QueuePreprocessor {
|
||||
|
||||
protected int writeFirstFragment(TunnelGateway.Pending msg, byte target[], int offset) {
|
||||
boolean fragmented = false;
|
||||
int origOffset = offset;
|
||||
|
||||
int instructionsLength = getInstructionsSize(msg);
|
||||
int payloadLength = msg.getData().length - msg.getOffset();
|
||||
if (offset + payloadLength + instructionsLength + IV_SIZE + 1 + 4 > PREPROCESSED_SIZE) {
|
||||
|
||||
@@ -284,11 +284,6 @@ class BuildExecutor implements Runnable {
|
||||
List<TunnelPool> wanted = new ArrayList(MAX_CONCURRENT_BUILDS);
|
||||
List<TunnelPool> pools = new ArrayList(8);
|
||||
|
||||
//long loopBegin = 0;
|
||||
//long afterBuildZeroHop = 0;
|
||||
long afterBuildReal = 0;
|
||||
long afterHandleInbound = 0;
|
||||
|
||||
while (_isRunning && !_manager.isShutdown()){
|
||||
//loopBegin = System.currentTimeMillis();
|
||||
try {
|
||||
@@ -383,7 +378,6 @@ class BuildExecutor implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
afterBuildReal = System.currentTimeMillis();
|
||||
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("build loop complete, tot=" + (afterHandleInbound-loopBegin) +
|
||||
|
||||
@@ -202,8 +202,6 @@ class BuildHandler implements Runnable {
|
||||
// search through the tunnels for a reply
|
||||
long replyMessageId = state.msg.getUniqueId();
|
||||
PooledTunnelCreatorConfig cfg = _exec.removeFromBuilding(replyMessageId);
|
||||
StringBuilder buf = null;
|
||||
|
||||
if (cfg == null) {
|
||||
// cannot handle - not pending... took too long?
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
|
||||
@@ -903,7 +903,6 @@ public class TunnelPool {
|
||||
|
||||
int fallback = 0;
|
||||
synchronized (_tunnels) {
|
||||
boolean enough = _tunnels.size() > wanted;
|
||||
for (int i = 0; i < _tunnels.size(); i++) {
|
||||
TunnelInfo info = _tunnels.get(i);
|
||||
if (allowZeroHop || (info.getLength() > 1)) {
|
||||
|
||||
Reference in New Issue
Block a user