* i2psnark: Eliminate duplicate requests caused by i2p-bt's
      rapid choke/unchokes
    * i2psnark: Truncate long TrackerErr messages on web page
This commit is contained in:
zzz
2006-09-20 22:39:24 +00:00
committed by zzz
parent 23e8a558c2
commit e8e8bac694
4 changed files with 30 additions and 6 deletions

View File

@ -353,8 +353,23 @@ class PeerConnectionOut implements Runnable
void sendRequest(Request req)
{
// should we check for duplicate requests to deal with fibrillating i2p-bt??
// or just send some cancels when we get an unwanted chunk??
// Check for duplicate requests to deal with fibrillating i2p-bt
// (multiple choke/unchokes received cause duplicate requests in the queue)
synchronized(sendQueue)
{
Iterator it = sendQueue.iterator();
while (it.hasNext())
{
Message m = (Message)it.next();
if (m.type == Message.REQUEST && m.piece == req.piece &&
m.begin == req.off && m.length == req.len)
{
if (_log.shouldLog(Log.DEBUG))
_log.debug("Discarding duplicate request " + req + " to peer " + peer);
return;
}
}
}
Message m = new Message();
m.type = Message.REQUEST;
m.piece = req.piece;

View File

@ -290,6 +290,7 @@ public class I2PSnarkServlet extends HttpServlet {
}
private static final int MAX_DISPLAYED_FILENAME_LENGTH = 60;
private static final int MAX_DISPLAYED_ERROR_LENGTH = 30;
private void displaySnark(PrintWriter out, Snark snark, String uri, int row, long stats[]) throws IOException {
String filename = snark.torrent;
File f = new File(filename);
@ -331,8 +332,11 @@ public class I2PSnarkServlet extends HttpServlet {
if (err != null) {
if (isRunning)
statusString = "TrackerErr (" + curPeers + "/" + knownPeers + " peers)";
else
else {
if (err.length() > MAX_DISPLAYED_ERROR_LENGTH)
err = err.substring(0, MAX_DISPLAYED_ERROR_LENGTH) + "...";
statusString = "TrackerErr (" + err + ")";
}
} else if (remaining <= 0) {
if (isRunning)
statusString = "Seeding (" + curPeers + "/" + knownPeers + " peers)";

View File

@ -1,4 +1,9 @@
$Id: history.txt,v 1.521 2006-09-13 21:37:33 zzz Exp $
$Id: history.txt,v 1.522 2006-09-16 16:07:30 zzz Exp $
2006-09-20 zzz
* i2psnark: Eliminate duplicate requests caused by i2p-bt's
rapid choke/unchokes
* i2psnark: Truncate long TrackerErr messages on web page
2006-09-16 zzz
* i2psnark: Implement retransmission of requests. This

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.458 $ $Date: 2006-09-13 21:37:32 $";
public final static String ID = "$Revision: 1.459 $ $Date: 2006-09-16 16:07:28 $";
public final static String VERSION = "0.6.1.25";
public final static long BUILD = 5;
public final static long BUILD = 6;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);