Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv2307/src/freenet
Modified Files:
ConnectionHandler.java OpenConnectionManager.java Version.java
Log Message:
6171:
Add ConnectionHandler.useValue(). Use it to queue messages to the least congested
connection if we can't get a non-sending() connection. Prevents a nasty feedback
situation. Also tweak the 2 connections logic - it's 2 *message* connections, not 2
connections full stop.
Process queued connections immediately on going below lowRunningConnections, don't
wait for the next incoming connection.
Update LocalHTTPInterface a bit (not actually used, just for testing new HTTP
infrastructure).
Logging, indenting.
Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -r1.141 -r1.142
--- ConnectionHandler.java 4 Sep 2003 22:45:05 -0000 1.141
+++ ConnectionHandler.java 5 Sep 2003 03:32:43 -0000 1.142
@@ -2853,6 +2853,14 @@
return trailingPresent;
}
+ /**
+ * Return an integer representation of the cost of routing over this
connection.
+ * The higher the worse.
+ */
+ public final int useValue() {
+ if(trailingPresent) return Integer.MAX_VALUE;
+ return sendingQueueBytes;
+ }
/**
[EMAIL PROTECTED] whether the connection is currently sending something
Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- OpenConnectionManager.java 4 Sep 2003 22:45:05 -0000 1.93
+++ OpenConnectionManager.java 5 Sep 2003 03:32:43 -0000 1.94
@@ -180,21 +180,30 @@
res.setCached(true);
return res;
} else {
- sendingConns++;
+ if(!res.reallySending())
+ sendingConns++;
Core.logger.log(this, "Skipping: "+res+": sending",
Logger.DEBUG);
}
}
- if(sendingConns < 2) return null;
+ if(sendingConns < 2) return null; // open another one
+ ConnectionHandler best = null;
+ int bestVal = Integer.MAX_VALUE;
for (Enumeration e = chs.getAll(id) ; e.hasMoreElements() ; ) {
ConnectionHandler res = (ConnectionHandler) e.nextElement();
if (!res.isOpen()) {
// Ignore it
} else if (!res.reallySending()) {
- lru.push(res);
- res.setCached(true);
- return res;
+ if(res.useValue() < bestVal) {
+ best = res;
+ bestVal = res.useValue();
+ }
}
+ }
+ if(best != null) {
+ lru.push(best);
+ best.setCached(true);
+ return best;
}
return null;
}
Index: Version.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Version.java,v
retrieving revision 1.363
retrieving revision 1.364
diff -u -r1.363 -r1.364
--- Version.java 5 Sep 2003 02:00:45 -0000 1.363
+++ Version.java 5 Sep 2003 03:32:43 -0000 1.364
@@ -18,7 +18,7 @@
public static String protocolVersion = "1.46";
/** The build number of the current revision */
- public static final int buildNumber = 6170;
+ public static final int buildNumber = 6171;
// 6028: may 3; ARK retrieval fix
public static final int ignoreBuildsAfter = 6500;
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs