2005-02-19 jrandom
* Only build new extra tunnels on failure if we don't have enough * Fix a fencepost in the tunnel building so that e.g. a variance of 2 means +/- 2, not +/- 1 (thanks dm!) * Avoid an NPE on client disconnect * Never select a shitlisted peer to participate in a tunnel * Have netDb store messages timeout after 10s, not the full 60s (duh) * Keep session tags around for a little longer, just in case (grr) * Cleaned up some closing event issues on the streaming lib * Stop bundling the jetty 5.1.2 and updated wrapper.config in the update so that 0.4.* users will need to do a clean install, but we don't need to shove an additional 2MB in each update to those already on 0.5. * Imported the susimail css (oops, thanks susi!)
This commit is contained in:
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
||||
*
|
||||
*/
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.141 $ $Date: 2005/02/17 12:59:28 $";
|
||||
public final static String ID = "$Revision: 1.142 $ $Date: 2005/02/17 17:57:53 $";
|
||||
public final static String VERSION = "0.5";
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -22,7 +22,8 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
public class RepublishLeaseSetJob extends JobImpl {
|
||||
private Log _log;
|
||||
private final static long REPUBLISH_LEASESET_DELAY = 60*1000; // 5 mins
|
||||
private final static long REPUBLISH_LEASESET_DELAY = 5*60*1000; // 5 mins
|
||||
private final static long REPUBLISH_LEASESET_TIMEOUT = 60*1000;
|
||||
private Hash _dest;
|
||||
private KademliaNetworkDatabaseFacade _facade;
|
||||
|
||||
@ -43,7 +44,7 @@ public class RepublishLeaseSetJob extends JobImpl {
|
||||
if (!ls.isCurrent(Router.CLOCK_FUDGE_FACTOR)) {
|
||||
_log.warn("Not publishing a LOCAL lease that isn't current - " + _dest, new Exception("Publish expired LOCAL lease?"));
|
||||
} else {
|
||||
getContext().jobQueue().addJob(new StoreJob(getContext(), _facade, _dest, ls, new OnSuccess(getContext()), new OnFailure(getContext()), REPUBLISH_LEASESET_DELAY));
|
||||
getContext().jobQueue().addJob(new StoreJob(getContext(), _facade, _dest, ls, new OnSuccess(getContext()), new OnFailure(getContext()), REPUBLISH_LEASESET_TIMEOUT));
|
||||
}
|
||||
} else {
|
||||
_log.warn("Client " + _dest + " is local, but we can't find a valid LeaseSet? perhaps its being rebuilt?");
|
||||
|
@ -199,7 +199,7 @@ class StoreJob extends JobImpl {
|
||||
// _log.debug(getJobId() + ": Send store to " + router.getIdentity().getHash().toBase64());
|
||||
}
|
||||
|
||||
sendStore(msg, router, _expiration);
|
||||
sendStore(msg, router, getContext().clock().now() + STORE_TIMEOUT_MS);
|
||||
}
|
||||
|
||||
private void sendStore(DatabaseStoreMessage msg, RouterInfo peer, long expiration) {
|
||||
@ -315,7 +315,7 @@ class StoreJob extends JobImpl {
|
||||
|
||||
sendNext();
|
||||
}
|
||||
public String getName() { return "Kademlia Store Failed"; }
|
||||
public String getName() { return "Kademlia Store Peer Failed"; }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -690,6 +690,9 @@ public class ProfileOrganizer {
|
||||
// the CLI shouldn't depend upon the netDb
|
||||
if (netDb == null) return true;
|
||||
if (_context.router() == null) return true;
|
||||
if ( (_context.shitlist() != null) && (_context.shitlist().isShitlisted(peer)) )
|
||||
return false; // never select a shitlisted peer
|
||||
|
||||
if (null != netDb.lookupRouterInfoLocally(peer)) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Peer " + peer.toBase64() + " is locally known, allowing its use");
|
||||
|
@ -80,6 +80,11 @@ public class InboundMessageDistributor implements GarlicMessageReceiver.CloveRec
|
||||
// ok, they want us to send it remotely, but that'd bust our anonymity,
|
||||
// so we send it out a tunnel first
|
||||
TunnelInfo out = _context.tunnelManager().selectOutboundTunnel(_client);
|
||||
if (out == null) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("no outbound tunnel to send the client message for " + _client + ": " + msg);
|
||||
return;
|
||||
}
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("distributing inbound tunnel message back out " + out
|
||||
+ " targetting " + target.toBase64().substring(0,4));
|
||||
|
@ -26,10 +26,14 @@ abstract class TunnelPeerSelector {
|
||||
if (settings.getLengthVariance() != 0) {
|
||||
int skew = settings.getLengthVariance();
|
||||
if (skew > 0)
|
||||
length += ctx.random().nextInt(skew);
|
||||
length += ctx.random().nextInt(skew+1);
|
||||
else {
|
||||
skew = 0 - skew;
|
||||
length += ctx.random().nextInt(2*skew) - skew;
|
||||
skew = 1 - skew;
|
||||
int off = ctx.random().nextInt(skew);
|
||||
if (ctx.random().nextBoolean())
|
||||
length += off;
|
||||
else
|
||||
length -= off;
|
||||
}
|
||||
if (length < 0)
|
||||
length = 0;
|
||||
|
@ -298,7 +298,8 @@ public class TunnelPool {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(toString() + ": unable to build a new leaseSet on failure (" + remaining
|
||||
+ " remaining), request a new tunnel");
|
||||
buildFake(false);
|
||||
if (remaining < _settings.getBackupQuantity() + _settings.getQuantity())
|
||||
buildFake(false);
|
||||
}
|
||||
}
|
||||
refreshBuilders();
|
||||
@ -320,8 +321,9 @@ public class TunnelPool {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn(toString() + ": unable to build a new leaseSet on expire (" + remaining
|
||||
+ " remaining), request a new tunnel");
|
||||
if (_settings.getAllowZeroHop())
|
||||
buildFake();
|
||||
if ( (remaining < _settings.getBackupQuantity() + _settings.getQuantity())
|
||||
&& (_settings.getAllowZeroHop()) )
|
||||
buildFake();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user