Author: toad
Date: 2008-06-14 20:02:30 +0000 (Sat, 14 Jun 2008)
New Revision: 20352
Modified:
branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java
Log:
Don't try to remove the FCPClient if we were killed because of a duplicate
connection.
Modified: branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
2008-06-14 19:57:18 UTC (rev 20351)
+++ branches/db4o/freenet/src/freenet/node/fcp/FCPConnectionHandler.java
2008-06-14 20:02:30 UTC (rev 20352)
@@ -68,6 +68,7 @@
final HashMap requestsByIdentifier;
protected final String connectionIdentifier;
static boolean logMINOR;
+ private boolean killedDupe;
// We are confident that the given client can access those
private final HashMap checkedDirectories = new HashMap();
@@ -100,13 +101,16 @@
rebootClient.onLostConnection(this);
if(foreverClient != null)
foreverClient.onLostConnection(this);
+ boolean dupe;
synchronized(this) {
isClosed = true;
requests = new
ClientRequest[requestsByIdentifier.size()];
requests = (ClientRequest[])
requestsByIdentifier.values().toArray(requests);
+ dupe = killedDupe;
}
for(int i=0;i<requests.length;i++)
requests[i].onLostConnection();
+ if(!dupe) {
server.core.clientContext.jobRunner.queue(new DBJob() {
public void run(ObjectContainer container,
ClientContext context) {
@@ -117,9 +121,14 @@
}
}, NativeThread.NORM_PRIORITY, false);
+ }
outputHandler.onClosed();
}
+ synchronized void setKilledDupe() {
+ killedDupe = true;
+ }
+
public synchronized boolean isClosed() {
return isClosed;
}
Modified: branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java 2008-06-14
19:57:18 UTC (rev 20351)
+++ branches/db4o/freenet/src/freenet/node/fcp/FCPServer.java 2008-06-14
20:02:30 UTC (rev 20352)
@@ -460,6 +460,7 @@
oldClient.setConnection(handler);
} else {
// Kill old connection
+ oldConn.setKilledDupe();
oldConn.outputHandler.queue(new
CloseConnectionDuplicateClientNameMessage());
oldConn.close();
oldClient.setConnection(handler);