2006-02-16 jrandom

* Bugfix to the I2PTunnel web config to properly accept i2cp port settings
    * Initial sucker refactoring to simplify reuse of the html parsing
    * Beginnings of hooks to push imported rss/atom out to remote syndie
      archives automatically (though not enabled currently)
    * Further SSU peer test cleanup
This commit is contained in:
jrandom
2006-02-16 08:24:07 +00:00
committed by zzz
parent 3d76df6af3
commit 79f934fe17
15 changed files with 245 additions and 193 deletions

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.341 $ $Date: 2006/02/15 00:33:33 $";
public final static String ID = "$Revision: 1.342 $ $Date: 2006/02/15 08:36:32 $";
public final static String VERSION = "0.6.1.9";
public final static long BUILD = 26;
public final static long BUILD = 27;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -27,6 +27,7 @@ public class IntroductionManager {
_outbound = Collections.synchronizedMap(new HashMap(128));
_inbound = new ArrayList(128);
ctx.statManager().createRateStat("udp.receiveRelayIntro", "How often we get a relayed request for us to talk to someone?", "udp", new long[] { 60*1000, 5*60*1000, 10*60*1000 });
ctx.statManager().createRateStat("udp.receiveRelayRequest", "How often we receive a request to relay to someone else?", "udp", new long[] { 60*1000, 5*60*1000, 10*60*1000 });
}
public void reset() {
@@ -91,6 +92,7 @@ public class IntroductionManager {
}
public void receiveRelayRequest(RemoteHostId alice, UDPPacketReader reader) {
_context.statManager().addRateData("udp.receiveRelayRequest", 1, 0);
if (_context.router().isHidden())
return;
long tag = reader.getRelayRequestReader().readTag();

View File

@@ -47,6 +47,8 @@ class PeerTestManager {
_currentTest = null;
_currentTestComplete = false;
_context.statManager().createRateStat("udp.statusKnownCharlie", "How often the bob we pick passes us to a charlie we already have a session with?", "udp", new long[] { 60*1000, 20*60*1000, 60*60*1000 });
_context.statManager().createRateStat("udp.receiveTestReply", "How often we get a reply to our peer test?", "udp", new long[] { 60*1000, 20*60*1000, 60*60*1000 });
_context.statManager().createRateStat("udp.receiveTest", "How often we get a packet requesting us to participate in a peer test?", "udp", new long[] { 60*1000, 20*60*1000, 60*60*1000 });
}
private static final int RESEND_TIMEOUT = 5*1000;
@@ -146,6 +148,7 @@ class PeerTestManager {
* test
*/
private void receiveTestReply(RemoteHostId from, UDPPacketReader.PeerTestReader testInfo) {
_context.statManager().addRateData("udp.receiveTestReply", 1, 0);
PeerTestState test = _currentTest;
if (expired())
return;
@@ -161,7 +164,7 @@ class PeerTestManager {
test.setAlicePort(testInfo.readPort());
if (_log.shouldLog(Log.DEBUG))
_log.debug("Receive test reply from bob @ " + from.getIP() + " via our " + test.getAlicePort() + "/" + test.getAlicePortFromCharlie());
_log.debug("Receive test reply from bob @ " + from + " via our " + test.getAlicePort() + "/" + test.getAlicePortFromCharlie());
if (test.getAlicePortFromCharlie() > 0)
testComplete(false);
} catch (UnknownHostException uhe) {
@@ -177,6 +180,7 @@ class PeerTestManager {
if (_log.shouldLog(Log.WARN))
_log.warn("Bob chose a charlie we already have a session to, cancelling the test and rerunning (bob: "
+ _currentTest + ", charlie: " + from + ")");
_currentTestComplete = true;
_context.statManager().addRateData("udp.statusKnownCharlie", 1, 0);
honorStatus(CommSystemFacade.STATUS_UNKNOWN);
return;
@@ -286,6 +290,7 @@ class PeerTestManager {
*
*/
public void receiveTest(RemoteHostId from, UDPPacketReader reader) {
_context.statManager().addRateData("udp.receiveTest", 1, 0);
UDPPacketReader.PeerTestReader testInfo = reader.getPeerTestReader();
byte testIP[] = null;
int testPort = testInfo.readPort();
@@ -318,7 +323,7 @@ class PeerTestManager {
// initiated test
} else {
if (_log.shouldLog(Log.DEBUG))
_log.debug("We are charlie, as te testIP/port is " + testIP + ":" + testPort + " and the state is unknown for " + nonce);
_log.debug("We are charlie, as te testIP/port is " + RemoteHostId.toString(testIP) + ":" + testPort + " and the state is unknown for " + nonce);
// we are charlie, since alice never sends us her IP and port, only bob does (and,
// erm, we're not alice, since it isn't our nonce)
receiveFromBobAsCharlie(from, testInfo, nonce, null);

View File

@@ -113,7 +113,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private static final int MAX_CONSECUTIVE_FAILED = 5;
private static final int TEST_FREQUENCY = 3*60*1000;
private static final int TEST_FREQUENCY = 13*60*1000;
public UDPTransport(RouterContext ctx) {
super(ctx);
@@ -973,7 +973,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append(" pushes: ").append(pushCount);
buf.append(" expired? ").append(expired);
buf.append(" unacked: ").append(msg.getUnackedSize());
if (!successful) {
if ( (p != null) && (!successful) ) {
buf.append(" consec_failed: ").append(p.getConsecutiveFailedSends());
long timeSinceSend = _context.clock().now() - p.getLastSendFullyTime();
buf.append(" lastFullSend: ").append(timeSinceSend);

View File

@@ -68,8 +68,8 @@ public class TunnelParticipant {
ok = _inboundEndpointProcessor.retrievePreprocessedData(msg.getData(), 0, msg.getData().length, recvFrom);
if (!ok) {
if (_log.shouldLog(Log.ERROR))
_log.error("Failed to dispatch " + msg + ": processor=" + _processor
if (_log.shouldLog(Log.WARN))
_log.warn("Failed to dispatch " + msg + ": processor=" + _processor
+ " inboundEndpoint=" + _inboundEndpointProcessor);
return;
}

View File

@@ -82,8 +82,8 @@ class BuildExecutor implements Runnable {
PooledTunnelCreatorConfig cfg = (PooledTunnelCreatorConfig)expired.get(i);
// note the fact that this tunnel request timed out in the peers' profiles.
// or... not.
if (_log.shouldLog(Log.ERROR))
_log.error("Timed out waiting for reply asking for " + cfg);
if (_log.shouldLog(Log.INFO))
_log.info("Timed out waiting for reply asking for " + cfg);
TunnelPool pool = cfg.getTunnelPool();
if (pool != null)
pool.buildComplete(cfg);
@@ -274,8 +274,8 @@ class BuildExecutor implements Runnable {
}
long expireBefore = _context.clock().now() + 10*60*1000 - BuildRequestor.REQUEST_TIMEOUT;
if (cfg.getExpiration() <= expireBefore) {
if (_log.shouldLog(Log.ERROR))
_log.error("Build complete for expired tunnel: " + cfg);
if (_log.shouldLog(Log.INFO))
_log.info("Build complete for expired tunnel: " + cfg);
}
}

View File

@@ -221,8 +221,8 @@ class BuildHandler {
_context.statManager().addRateData("tunnel.buildClientReject", rtt, rtt);
}
} else {
if (_log.shouldLog(Log.ERROR))
_log.error(msg.getUniqueId() + ": Tunnel reply could not be decrypted for tunnel " + cfg);
if (_log.shouldLog(Log.WARN))
_log.warn(msg.getUniqueId() + ": Tunnel reply could not be decrypted for tunnel " + cfg);
}
}
@@ -247,8 +247,8 @@ class BuildHandler {
_context.statManager().addRateData("tunnel.decryptRequestTime", decryptTime, decryptTime);
if (req == null) {
// no records matched, or the decryption failed. bah
if (_log.shouldLog(Log.ERROR))
_log.error("The request " + state.msg.getUniqueId() + " could not be decrypted");
if (_log.shouldLog(Log.WARN))
_log.warn("The request " + state.msg.getUniqueId() + " could not be decrypted");
return;
}
@@ -309,8 +309,8 @@ class BuildHandler {
public String getName() { return "Timeout looking for next peer for tunnel join"; }
public void runJob() {
getContext().statManager().addRateData("tunnel.rejectTimeout", 1, 1);
if (_log.shouldLog(Log.ERROR))
_log.error("Request " + _state.msg.getUniqueId()
if (_log.shouldLog(Log.WARN))
_log.warn("Request " + _state.msg.getUniqueId()
+ " could no be satisfied, as the next peer could not be found: " + _nextPeer.toBase64());
getContext().messageHistory().tunnelRejected(_state.fromHash, new TunnelId(_req.readReceiveTunnelId()), _nextPeer,
"rejected because we couldn't find " + _nextPeer.toBase64() + ": " +