Compare commits

..

6 Commits

10 changed files with 47 additions and 37 deletions

View File

@@ -59,7 +59,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"Cache-control: no-cache\r\n"+
"\r\n"+
"<html><body><H1>I2P ERROR: DESTINATION NOT FOUND</H1>"+
"That I2P Desitination was not found. Perhaps you pasted in the "+
"That I2P Destination was not found. Perhaps you pasted in the "+
"wrong BASE64 I2P Destination or the link you are following is "+
"bad. The host (or the WWW proxy, if you're using one) could also "+
"be temporarily offline. You may want to <b>retry</b>. "+
@@ -71,7 +71,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"Content-Type: text/html; charset=iso-8859-1\r\n"+
"Cache-control: no-cache\r\n\r\n"+
"<html><body><H1>I2P ERROR: TIMEOUT</H1>"+
"That Desitination was reachable, but timed out getting a "+
"That Destination was reachable, but timed out getting a "+
"response. This is likely a temporary error, so you should simply "+
"try to refresh, though if the problem persists, the remote "+
"destination may have issues. Could not get a response from "+

View File

@@ -454,7 +454,8 @@ class I2PSocketImpl implements I2PSocket {
_log.debug(getPrefix() + "Message size is: " + data.length);
boolean sent = sendBlock(data);
if (!sent) {
_log.error(getPrefix() + "Error sending message to peer. Killing socket runner");
if (_log.shouldLog(Log.WARN))
_log.warn(getPrefix() + "Error sending message to peer. Killing socket runner");
errorOccurred();
return false;
}
@@ -475,9 +476,10 @@ class I2PSocketImpl implements I2PSocket {
packetsHandled++;
}
if ((bc.getCurrentSize() > 0) && (packetsHandled > 1)) {
_log.error(getPrefix() + "A SCARY MONSTER HAS EATEN SOME DATA! " + "(input stream: "
+ in.hashCode() + "; "
+ "queue size: " + bc.getCurrentSize() + ")");
if (_log.shouldLog(Log.WARN))
_log.warn(getPrefix() + "We lost some data queued up due to a network send error (input stream: "
+ in.hashCode() + "; "
+ "queue size: " + bc.getCurrentSize() + ")");
}
synchronized (flagLock) {
closed2 = true;
@@ -492,7 +494,8 @@ class I2PSocketImpl implements I2PSocket {
byte[] packet = I2PSocketManager.makePacket(getMask(0x02), remoteID, new byte[0]);
boolean sent = manager.getSession().sendMessage(remote, packet);
if (!sent) {
_log.error(getPrefix() + "Error sending close packet to peer");
if (_log.shouldLog(Log.WARN))
_log.warn(getPrefix() + "Error sending close packet to peer");
errorOccurred();
}
}

View File

@@ -264,7 +264,8 @@ public class I2PSocketManager implements I2PSessionListener {
s.queueData(payload);
return;
} else {
_log.error(getName() + ": Null socket with data available");
if (_log.shouldLog(Log.WARN))
_log.warn(getName() + ": Null socket with data available");
throw new IllegalStateException("Null socket with data available");
}
}

View File

@@ -14,8 +14,8 @@ package net.i2p;
*
*/
public class CoreVersion {
public final static String ID = "$Revision: 1.11 $ $Date: 2004/07/11 13:57:02 $";
public final static String VERSION = "0.3.2.2";
public final static String ID = "$Revision: 1.12 $ $Date: 2004/07/14 20:08:54 $";
public final static String VERSION = "0.3.2.3";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -46,9 +46,13 @@ public interface ProfileManager {
/**
* Note that a router explicitly rejected joining a tunnel
*
*
* @param peer who rejected us
* @param responseTimeMs how long it took to get the rejection
* @param explicit true if the tunnel request was explicitly rejected, false
* if we just didn't get a reply back in time.
*/
void tunnelRejected(Hash peer, long responseTimeMs);
void tunnelRejected(Hash peer, long responseTimeMs, boolean explicit);
/**
* Note that a tunnel that the router is participating in

View File

@@ -15,8 +15,8 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.10 $ $Date: 2004/07/11 13:57:01 $";
public final static String VERSION = "0.3.2.2";
public final static String ID = "$Revision: 1.11 $ $Date: 2004/07/14 20:08:55 $";
public final static String VERSION = "0.3.2.3";
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -91,14 +91,17 @@ public class ProfileManagerImpl implements ProfileManager {
}
/**
* Note that a router explicitly rejected joining a tunnel
* Note that a router explicitly rejected joining a tunnel.
*
* @param explicit true if the tunnel request was explicitly rejected, false
* if we just didn't get a reply back in time.
*/
public void tunnelRejected(Hash peer, long responseTimeMs) {
public void tunnelRejected(Hash peer, long responseTimeMs, boolean explicit) {
PeerProfile data = getProfile(peer);
if (data == null) return;
data.setLastHeardFrom(_context.clock().now());
data.getTunnelHistory().incrementRejected();
if (explicit)
data.getTunnelHistory().incrementRejected();
}
/**

View File

@@ -1,6 +1,7 @@
package net.i2p.router.peermanager;
import net.i2p.router.RouterContext;
import net.i2p.stat.RateStat;
import net.i2p.util.Log;
/**
@@ -36,27 +37,24 @@ public class ReliabilityCalculator extends Calculator {
//val -= profile.getSendFailureSize().getRate(60*60*1000).getCurrentEventCount()*2;
//val -= profile.getSendFailureSize().getRate(60*60*1000).getLastEventCount()*2;
long rejectionPenalties =
(profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getCurrentEventCount() * 200)
+ (profile.getTunnelHistory().getRejectionRate().getRate(60*1000).getLastEventCount() * 100)
+ (profile.getTunnelHistory().getRejectionRate().getRate(10*60*1000).getCurrentEventCount() * 10)
+ (profile.getTunnelHistory().getRejectionRate().getRate(10*60*1000).getLastEventCount() * 5)
+ (profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getCurrentEventCount() * 1);
if ( (rejectionPenalties > 0) && (_log.shouldLog(Log.INFO)) )
_log.info("Rejection penalties for peer " + profile.getPeer().toBase64() + ": " + rejectionPenalties);
val -= rejectionPenalties;
//val -= profile.getTunnelHistory().getRejectionRate().getRate(60*60*1000).getLastEventCount() * 1;
RateStat rejRate = profile.getTunnelHistory().getRejectionRate();
if (rejRate.getRate(60*1000).getCurrentEventCount() > 0)
val -= 200;
if (rejRate.getRate(60*1000).getLastEventCount() > 0)
val -= 100;
if (rejRate.getRate(10*60*1000).getCurrentEventCount() > 0)
val -= 10;
if (rejRate.getRate(10*60*1000).getCurrentEventCount() > 0)
val -= 5;
// penalize them heavily for dropping netDb requests
// penalize them heavily for dropping netDb requests (though these could have
// failed due to tunnel timeouts, so don't be too mean)
if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getCurrentEventCount() > 0)
val -= 10;
if (profile.getDBHistory().getFailedLookupRate().getRate(60*1000).getLastEventCount() > 0)
val -= 5;
//val -= profile.getDBHistory().getFailedLookupRate().getRate(60*60*1000).getCurrentEventCount();
//val -= profile.getDBHistory().getFailedLookupRate().getRate(60*60*1000).getLastEventCount();
//val -= profile.getDBHistory().getFailedLookupRate().getRate(24*60*60*1000).getCurrentEventCount() * 50;
//val -= profile.getDBHistory().getFailedLookupRate().getRate(24*60*60*1000).getLastEventCount() * 20;
val -= 5;
// scream and shout on network errors
if (profile.getCommError().getRate(60*1000).getCurrentEventCount() > 0)
val -= 200;
if (profile.getCommError().getRate(60*1000).getLastEventCount() > 0)

View File

@@ -766,7 +766,7 @@ public class RequestTunnelJob extends JobImpl {
_log.warn("Tunnel creation failed for tunnel " + _tunnel.getTunnelId()
+ " at router " + _tunnel.getThisHop().toBase64()
+ " with status " + msg.getStatus());
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime);
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime, true);
Success.this.getContext().messageHistory().tunnelRejected(_tunnel.getThisHop(),
_tunnel.getTunnelId(),
null, "refused");
@@ -832,8 +832,9 @@ public class RequestTunnelJob extends JobImpl {
_failedTunnelParticipants.add(_replyThrough);
}
Failure.this.getContext().messageHistory().tunnelRequestTimedOut(_tunnel.getThisHop(), _tunnel.getTunnelId(), _replyThrough);
// perhaps not an explicit reject, but an implicit one (due to overload & dropped messages, etc)
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), getContext().clock().now() - _started);
long responseTime = getContext().clock().now() - _started;
// perhaps not an explicit reject, but an implicit one (due to dropped messages, tunnel failure, etc)
getContext().profileManager().tunnelRejected(_tunnel.getThisHop(), responseTime, false);
getContext().profileManager().messageFailed(_tunnel.getThisHop());
Failure.this.getContext().statManager().updateFrequency("tunnel.buildFailFrequency");
fail();

View File

@@ -85,7 +85,7 @@ class TunnelPool {
}
if (id == null) {
if (_log.shouldLog(Log.ERROR))
_log.error(toString() + ": Id requested is null");
_log.error(toString() + ": Id requested is null", new Exception("wtf, why do you want a null?"));
return null;
}
boolean typeKnown = id.getType() != TunnelId.TYPE_UNSPECIFIED;