remove unused local variables (eclipse)

This commit is contained in:
zzz
2012-03-25 22:16:03 +00:00
parent f13956d380
commit 1db58dee89
55 changed files with 23 additions and 127 deletions

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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)) {

View File

@ -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);

View File

@ -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]));

View File

@ -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);

View File

@ -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();

View File

@ -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(),

View File

@ -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");
}

View File

@ -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

View File

@ -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) {

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -118,7 +118,6 @@ class InboundMessageFragments /*implements UDPTransport.PartialACKSource */{
continue;
}
int size = data.readMessageFragmentSize(i);
InboundMessageState state = null;
boolean messageComplete = false;
boolean messageExpired = false;

View File

@ -115,7 +115,6 @@ class MessageReceiver {
while (_alive) {
int expired = 0;
long expiredLifetime = 0;
int remaining = 0;
try {
while (message == null) {
message = _completeMessages.take();

View File

@ -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());

View File

@ -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>");

View File

@ -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) {

View File

@ -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) +

View File

@ -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))

View File

@ -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)) {