diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java index 0317f2be63..98c02c9067 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java @@ -231,8 +231,8 @@ public class PeerCoordinator implements PeerListener synchronized(peers) { Peer old = peerIDInList(peer.getPeerID(), peers); - if ( (old != null) && (old.getInactiveTime() > 2*60*1000) ) { - // idle for 2 minutes, kill the old con + if ( (old != null) && (old.getInactiveTime() > 4*60*1000) ) { + // idle for 4 minutes, kill the old con (64KB/4min = 273B/sec minimum for one block) if (_log.shouldLog(Log.WARN)) _log.warn("Remomving old peer: " + peer + ": " + old + ", inactive for " + old.getInactiveTime()); peers.remove(old); @@ -448,13 +448,13 @@ public class PeerCoordinator implements PeerListener } if (piece == null) { if (_log.shouldLog(Log.WARN)) - _log.warn("nothing to even rerequest from " + peer + ": requested = " + requested - + " wanted = " + wantedPieces + " peerHas = " + havePieces); + _log.warn("nothing to even rerequest from " + peer + ": requested = " + requested); + // _log.warn("nothing to even rerequest from " + peer + ": requested = " + requested + // + " wanted = " + wantedPieces + " peerHas = " + havePieces); return -1; //If we still can't find a piece we want, so be it. } else { // Should be a lot smarter here - limit # of parallel attempts and - // share data rather than starting from 0 with each peer. - // And could share-as-we-go too. + // share blocks rather than starting from 0 with each peer. // This is where the flaws of the snark data model are really exposed. // Could also randomize within the duplicate set rather than strict rarest-first if (_log.shouldLog(Log.DEBUG)) @@ -654,13 +654,15 @@ public class PeerCoordinator implements PeerListener if (savedRequest == null || req.off > savedRequest.off || System.currentTimeMillis() > savedRequestTime + (15 * 60 * 1000)) { + if (savedRequest == null || (req.piece != savedRequest.piece && req.off != savedRequest.off)) { + if (_log.shouldLog(Log.DEBUG)) { + _log.debug(" Saving orphaned partial piece " + req); + if (savedRequest != null) + _log.debug(" (Discarding previously saved orphan) " + savedRequest); + } + } savedRequest = req; savedRequestTime = System.currentTimeMillis(); - if (_log.shouldLog(Log.DEBUG)) - _log.debug(" Saving orphaned partial piece " + req); - if (savedRequest != null) - if (_log.shouldLog(Log.DEBUG)) - _log.debug(" (Discarding previously saved orphan) " + savedRequest); } else { if (req.piece != savedRequest.piece) if (_log.shouldLog(Log.DEBUG)) diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerState.java b/apps/i2psnark/java/src/org/klomp/snark/PeerState.java index ae42a1a021..2e134704d4 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerState.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerState.java @@ -556,7 +556,7 @@ class PeerState } } - synchronized void keepAlive() + void keepAlive() { out.sendAlive(); } diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 04fdc16a48..e765d7948e 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -321,8 +321,10 @@ public class I2PSnarkServlet extends HttpServlet { else statusString = "Complete"; } else { - if (isRunning) + if (isRunning && curPeers > 0) statusString = "OK (" + curPeers + "/" + knownPeers + " peers)"; + else if (isRunning) + statusString = "No Peers (0/" + knownPeers + ")"; else statusString = "Stopped"; } @@ -341,22 +343,23 @@ public class I2PSnarkServlet extends HttpServlet { out.write(""); out.write("\n\t"); - out.write(""); - if (remaining > 0) { - out.write(formatSize(total-remaining) + "/" + formatSize(total)); // 18MB/3GB - if(isRunning && remainingSeconds > 0) - out.write(" (ETA " + DataHelper.formatDuration(remainingSeconds*1000) + ")"); // (eta 6h) - } else { - out.write(formatSize(total)); // 3GB - } + out.write(""); + if(isRunning && remainingSeconds > 0) + out.write(DataHelper.formatDuration(remainingSeconds*1000)); // (eta 6h) out.write("\n\t"); - out.write(""); + if (remaining > 0) + out.write(formatSize(total-remaining) + "/" + formatSize(total)); // 18MB/3GB + else + out.write(formatSize(total)); // 3GB + out.write("\n\t"); + out.write("" + formatSize(uploaded) + "\n\t"); - out.write(""); + out.write(""); if(isRunning && remaining > 0) out.write(formatSize(downBps) + "ps"); out.write("\n\t"); - out.write(""); + out.write(""); if(isRunning) out.write(formatSize(upBps) + "ps"); out.write("\n\t"); @@ -550,7 +553,10 @@ public class I2PSnarkServlet extends HttpServlet { "}\n" + "th {\n" + " background-color: #C7D5D5;\n" + - " margin: 0px 0px 0px 0px;\n" + + " padding: 0px 7px 0px 3px;\n" + + "}\n" + + "td {\n" + + " padding: 0px 7px 0px 3px;\n" + "}\n" + ".snarkTorrentEven {\n" + " background-color: #E7E7E7;\n" + @@ -578,20 +584,21 @@ public class I2PSnarkServlet extends HttpServlet { "\n"; - private static final String TABLE_HEADER = "\n" + + private static final String TABLE_HEADER = "
\n" + "\n" + "\n" + " \n" + - " \n" + - " \n" + - " \n" + - " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + " \n" + "\n"; private static final String TABLE_EMPTY = "" + "\n"; + " valign=\"top\" colspan=\"8\">No torrents\n"; private static final String TABLE_FOOTER = "
StatusTorrentDownloadedUploadedDown RateUp RateETADownloadedUploadedDown RateUp Rate 
No torrents
\n"; diff --git a/history.txt b/history.txt index a40f894c2b..0a6bf10503 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,9 @@ -$Id: history.txt,v 1.510 2006-09-04 03:26:22 zzz Exp $ +$Id: history.txt,v 1.511 2006-09-06 01:32:54 zzz Exp $ + +2006-09-07 zzz + * i2psnark: Increase output timeout from 2 min to 4 min + * i2psnark: Orphan debug msg cleanup + * i2psnark: More web rate report cleanup 2006-09-05 zzz * i2psnark: Implement basic partial-piece saves across connections diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index a9f80a367f..841a61e09f 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.450 $ $Date: 2006-09-04 03:26:21 $"; + public final static String ID = "$Revision: 1.451 $ $Date: 2006-09-06 01:32:53 $"; public final static String VERSION = "0.6.1.24"; - public final static long BUILD = 9; + public final static long BUILD = 10; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID);