Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv1947/src/freenet
Modified Files:
ConnectionHandler.java OpenConnectionManager.java Version.java
Log Message:
6172:
Change synchronization in OCM.findFreeConn to allow us to call scheduleConnOpener. Do
it if necessary (start a conn opener and take the existing conn, if we have only 1
message sending connection). Might cause other deadlocks, we shall see.
If we are not throttling, try write all jobs in WSL!
If we skip a throttled conn because we've already processed some, and we don't get
backed off for throttling, use zero selector timeout.
Put a limit (1 hour) on the IOException on write backoff in FileLoggerHook.
Logging
Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- ConnectionHandler.java 5 Sep 2003 03:32:43 -0000 1.142
+++ ConnectionHandler.java 5 Sep 2003 16:08:51 -0000 1.143
@@ -2298,7 +2298,7 @@
try {
if (logDEBUG)
Core.logger.log(this,"executing messageSend "+
-
"immediately ("+this+")",
+
"immediately ("+this+","+ms+")",
Logger.DEBUG);
currentSender = ms;
sentMessages.add(ms);
Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- OpenConnectionManager.java 5 Sep 2003 03:32:43 -0000 1.94
+++ OpenConnectionManager.java 5 Sep 2003 16:08:51 -0000 1.95
@@ -157,55 +157,62 @@
* This will return an open and not busy ConnectionHandler to the
* node identified.
*/
- public synchronized ConnectionHandler findFreeConnection(Identity id) {
+ public ConnectionHandler findFreeConnection(Identity id) {
Core.logger.log(this, "findFreeConnection("+id+")",
new Exception("debug"), Logger.DEBUG);
int sendingConns = 0;
- for (Enumeration e = chs.getAll(id) ; e.hasMoreElements() ; ) {
- ConnectionHandler res = (ConnectionHandler) e.nextElement();
- if (!res.isOpen()) {
- if(Core.logger.shouldLog(Logger.DEBUG))
- Core.logger.log(this, "Skipped closed
connection "+res,
+ synchronized(this) {
+ for (Enumeration e = chs.getAll(id) ; e.hasMoreElements() ; ) {
+ ConnectionHandler res = (ConnectionHandler)
e.nextElement();
+ if (!res.isOpen()) {
+ if(Core.logger.shouldLog(Logger.DEBUG))
+ Core.logger.log(this, "Skipped closed
connection "+res,
+
Logger.DEBUG);
+ // It will be terminated eventually
+ // Do not remove it from OCM because it will
then be orphaned and take up a fd even though it is not available for sending.
+ } else if (!res.sending()) {
+ Core.logger.log(this, "Found "+res,
Logger.DEBUG);
+ // found one
+ lru.push(res);
+ // Mark this connection as cached
+ // so we know to discount it in
+ // connection success accounting in
+ // the Routing implementation.
+ res.setCached(true);
+ return res;
+ } else {
+ if(!res.reallySending())
+ sendingConns++;
+ Core.logger.log(this, "Skipping: "+res+":
sending",
Logger.DEBUG);
- // It will be terminated eventually
- // Do not remove it from OCM because it will then be
orphaned and take up a fd even though it is not available for sending.
- } else if (!res.sending()) {
- Core.logger.log(this, "Found "+res, Logger.DEBUG);
- // found one
- lru.push(res);
- // Mark this connection as cached
- // so we know to discount it in
- // connection success accounting in
- // the Routing implementation.
- res.setCached(true);
- return res;
- } else {
- if(!res.reallySending())
- sendingConns++;
- Core.logger.log(this, "Skipping: "+res+": sending",
- Logger.DEBUG);
+ }
}
- }
- if(sendingConns < 2) return null; // open another one
+ }
+ if(sendingConns < 2) {
+ Main.node.scheduleConnectionOpener(id);
+ // 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()) {
- if(res.useValue() < bestVal) {
- best = res;
- bestVal = res.useValue();
+ synchronized(this) {
+ for (Enumeration e = chs.getAll(id) ; e.hasMoreElements() ; ) {
+ ConnectionHandler res = (ConnectionHandler)
e.nextElement();
+ if (!res.isOpen()) {
+ // Ignore it
+ } else if (!res.reallySending()) {
+ if(res.useValue() < bestVal) {
+ best = res;
+ bestVal = res.useValue();
+ }
}
}
+ if(best != null) {
+ lru.push(best);
+ best.setCached(true);
+ return best;
+ }
+ return null;
}
- 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.364
retrieving revision 1.365
diff -u -r1.364 -r1.365
--- Version.java 5 Sep 2003 03:32:43 -0000 1.364
+++ Version.java 5 Sep 2003 16:08:51 -0000 1.365
@@ -18,7 +18,7 @@
public static String protocolVersion = "1.46";
/** The build number of the current revision */
- public static final int buildNumber = 6171;
+ public static final int buildNumber = 6172;
// 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