2008-01-07 zzz

* profiles.jsp formatting cleanup
    * NTCP: Reduce max idle time from 60m to 20m
    * NTCP: Fix idle time on connections with zero messages,
      correctly drop these connections
This commit is contained in:
zzz
2008-01-07 08:09:43 +00:00
committed by zzz
parent fbf6282c1a
commit f838b1828b
5 changed files with 19 additions and 11 deletions

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.545 $ $Date: 2008-01-02 17:08:48 $";
public final static String ID = "$Revision: 1.546 $ $Date: 2008-01-03 21:37:24 $";
public final static String VERSION = "0.6.1.30";
public final static long BUILD = 17;
public final static long BUILD = 18;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -91,12 +91,12 @@ class ProfileOrganizerRenderer {
buf.append("<tr>");
buf.append("<td><code>");
if (prof.getIsFailing()) {
buf.append("<font color=\"red\">--").append(peer.toBase64().substring(0,6)).append("</font>");
buf.append("<font color=\"red\">-- ").append(peer.toBase64().substring(0,6)).append("</font>");
} else {
if (prof.getIsActive()) {
buf.append("<font color=\"blue\">++").append(peer.toBase64().substring(0,6)).append("</font>");
buf.append("<font color=\"blue\">++ ").append(peer.toBase64().substring(0,6)).append("</font>");
} else {
buf.append("__").append(peer.toBase64().substring(0,6));
buf.append("&nbsp;&nbsp;&nbsp;").append(peer.toBase64().substring(0,6));
}
}
buf.append("</code></td>");

View File

@ -124,8 +124,8 @@ public class EventPumper implements Runnable {
int failsafeWrites = 0;
int failsafeCloses = 0;
long expireIdleWriteTime = 60*60*1000l + _context.random().nextLong(60*60*1000l);
// pointless if we do this every 2 seconds?
long expireIdleWriteTime = 20*60*1000l; // + _context.random().nextLong(60*60*1000l);
for (Iterator iter = all.iterator(); iter.hasNext(); ) {
try {
SelectionKey key = (SelectionKey)iter.next();
@ -143,7 +143,7 @@ public class EventPumper implements Runnable {
failsafeWrites++;
}
if ( (con.getTimeSinceSend() > expireIdleWriteTime) && (con.getMessagesSent() > 0) ) {
if ( con.getTimeSinceSend() > expireIdleWriteTime) {
// we haven't sent anything in a really long time, so lets just close 'er up
con.close();
failsafeCloses++;

View File

@ -111,6 +111,8 @@ public class NTCPConnection implements FIFOBandwidthLimiter.CompleteListener {
_context = ctx;
_log = ctx.logManager().getLog(getClass());
_created = System.currentTimeMillis();
_lastSendTime = _created;
_lastReceiveTime = _created;
_transport = transport;
_chan = chan;
_readBufs = new ArrayList(4);
@ -204,8 +206,8 @@ public class NTCPConnection implements FIFOBandwidthLimiter.CompleteListener {
return queued;
}
}
public long getTimeSinceSend() { return _lastSendTime <= 0 ? 0 : System.currentTimeMillis()-_lastSendTime; }
public long getTimeSinceReceive() { return _lastReceiveTime <= 0 ? 0 : System.currentTimeMillis()-_lastReceiveTime; }
public long getTimeSinceSend() { return System.currentTimeMillis()-_lastSendTime; }
public long getTimeSinceReceive() { return System.currentTimeMillis()-_lastReceiveTime; }
public long getTimeSinceCreated() { return System.currentTimeMillis()-_created; }
public int getConsecutiveBacklog() { return _consecutiveBacklog; }