Update of /cvsroot/freenet/freenet/src/freenet/node/states/request
In directory sc8-pr-cvs1:/tmp/cvs-serv12267/src/freenet/node/states/request
Modified Files:
Tag: ngrouting
DataPending.java InsertPending.java Pending.java
ReceivingInsert.java ReceivingReply.java SendingReply.java
TransferInsert.java TransferInsertPending.java
TransferReply.java
Log Message:
terminate() the route explicitly in states/. DO NOT terminate automatically in
transferFailed, because it usually isn't fatal (fixes nasty bug introduced yesterday
that caused RNFs). Add an ABC for NG-/Table- Routing, including most of the
terminate() logic.
Index: DataPending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/DataPending.java,v
retrieving revision 1.14.6.2
retrieving revision 1.14.6.3
diff -u -r1.14.6.2 -r1.14.6.3
--- DataPending.java 21 Aug 2003 00:26:48 -0000 1.14.6.2
+++ DataPending.java 28 Aug 2003 17:38:05 -0000 1.14.6.3
@@ -49,9 +49,11 @@
}
catch (EndOfRouteException e) {
dataNotFound(n);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
catch (RequestAbortException rae) {
+ // Might not be a RequestDone - terminate WHEN THROWING
return rae.state;
}
return new DataPending(this);
@@ -70,6 +72,7 @@
}
catch (EndOfRouteException e) {
dataNotFound(n);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
catch (RequestAbortException rae) {
@@ -132,6 +135,7 @@
// well, technically they did their job...
routes.routeSucceeded(dnf.source.isCached());
+ routes.terminate();
return new RequestDone(this);
}
@@ -139,6 +143,7 @@
long toq = n.ft.shouldFail(searchKey, hopsToLive);
if ((origPeer != null) && toq > 0) {
dataNotFound(n, toq, false);
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
}
}
Index: InsertPending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/InsertPending.java,v
retrieving revision 1.17.2.2
retrieving revision 1.17.2.3
diff -u -r1.17.2.2 -r1.17.2.3
--- InsertPending.java 26 Aug 2003 02:01:04 -0000 1.17.2.2
+++ InsertPending.java 28 Aug 2003 17:38:05 -0000 1.17.2.3
@@ -95,6 +95,7 @@
catch (RequestAbortException rae) {
cancelNoInsert();
// this is going to RequestDone with no route found
+ // Should be terminate()d at throw time, not at catch time
return rae.state;
}
return new InsertPending(this);
@@ -126,6 +127,7 @@
fail(n, "DataInsert never received");
queryAborted(n);
// Not our fault, this is from the requester, so don't tell Routing
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
@@ -137,6 +139,7 @@
cancelNoInsert();
queryAborted(n, qf);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
@@ -172,14 +175,16 @@
n.logger.log(this, "Failed to find data after key collision for "+this,
Logger.NORMAL);
- return new RequestDone(this);
- }
- catch (IOException e) {
+ if(routes != null) routes.terminate();
+ return new RequestDone(this);
+ } catch (IOException e) {
dim.drop(n);
fail(n, "I/O error receiving insert");
n.logger.log(this, "Failed to cache insert for " + this,
e, Logger.ERROR);
queryAborted(n);
+
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
@@ -216,6 +221,7 @@
n.logger.log(this, "Failed to cache insert for "+this,
e, Logger.ERROR);
queryAborted(n);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
finally {
@@ -319,6 +325,7 @@
n.logger.log(this,
"Failed to send back InsertReply, dropping for "+
this, e, Logger.MINOR);
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
}
}
@@ -351,6 +358,7 @@
n.logger.log(this, "Failed to read data from store for "+
this, e, Logger.ERROR);
}
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
}
}
Index: Pending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/Pending.java,v
retrieving revision 1.47.2.8
retrieving revision 1.47.2.9
diff -u -r1.47.2.8 -r1.47.2.9
--- Pending.java 27 Aug 2003 15:54:35 -0000 1.47.2.8
+++ Pending.java 28 Aug 2003 17:38:05 -0000 1.47.2.9
@@ -416,6 +416,7 @@
"Failed to find data after key collision on "+
this+" while caching DataReply",
Logger.NORMAL);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
catch (IOException e) {
@@ -424,6 +425,7 @@
fail(n, "I/O error replying with data");
n.logger.log(this, "I/O error caching DataReply "+this,
e, Logger.ERROR);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
@@ -619,6 +621,7 @@
n.logger.log(this,
"Couldn't restart because relaying QueryRestarted failed: "+
e+" for "+this, Logger.MINOR);
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
}
}
@@ -689,11 +692,13 @@
n.logger.log(this, "I/O error replying with data on "+this,
e, Logger.MINOR);
thrownTime = System.currentTimeMillis();
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
} catch (CommunicationException e) {
n.logger.log(this, "Error replying to peer: "+e+" on "+this,
e, Logger.MINOR);
thrownTime = System.currentTimeMillis();
+ if(routes != null) routes.terminate();
throw new RequestAbortException(new RequestDone(this));
} finally {
if (doc != null) {
Index: ReceivingInsert.java
===================================================================
RCS file:
/cvsroot/freenet/freenet/src/freenet/node/states/request/ReceivingInsert.java,v
retrieving revision 1.17.6.2
retrieving revision 1.17.6.3
diff -u -r1.17.6.2 -r1.17.6.3
--- ReceivingInsert.java 20 Aug 2003 18:09:22 -0000 1.17.6.2
+++ ReceivingInsert.java 28 Aug 2003 17:38:05 -0000 1.17.6.3
@@ -60,6 +60,7 @@
} catch (IOException e) {
fail(n, "Cache failed");
n.logger.log(this, "Cache failed on commit", e, Logger.ERROR);
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
n.logger.log(this, "Data received successfully!", Logger.MINOR);
@@ -93,6 +94,7 @@
"Failed to send back StoreData to peer " + e.peer,
e, Logger.MINOR);
}
+ if(routes != null) routes.terminate();
return new RequestDone(this);
case Presentation.CB_CACHE_FAILED:
@@ -103,6 +105,7 @@
"Failed to receive insert with CB
"+Presentation.getCBdescription(cb)
+", on chain "+Long.toHexString(id),
(cb == Presentation.CB_CACHE_FAILED ? Logger.ERROR :
Logger.MINOR));
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
}
Index: ReceivingReply.java
===================================================================
RCS file:
/cvsroot/freenet/freenet/src/freenet/node/states/request/ReceivingReply.java,v
retrieving revision 1.7.6.2
retrieving revision 1.7.6.3
diff -u -r1.7.6.2 -r1.7.6.3
--- ReceivingReply.java 21 Aug 2003 00:26:48 -0000 1.7.6.2
+++ ReceivingReply.java 28 Aug 2003 17:38:05 -0000 1.7.6.3
@@ -156,7 +156,7 @@
n.logger.log(this, "Transitioning to RequestDone from "+this,
Logger.DEBUG);
-
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
}
Index: SendingReply.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/SendingReply.java,v
retrieving revision 1.18.6.2
retrieving revision 1.18.6.3
diff -u -r1.18.6.2 -r1.18.6.3
--- SendingReply.java 20 Aug 2003 18:09:22 -0000 1.18.6.2
+++ SendingReply.java 28 Aug 2003 17:38:05 -0000 1.18.6.3
@@ -77,6 +77,7 @@
}
n.logger.log(this, "Finalizing sendingData: "+this, Logger.DEBUG);
sendingData.finalize();
+ if(routes != null) routes.terminate();
return new RequestDone(this);
case Presentation.CB_CACHE_FAILED:
@@ -90,6 +91,7 @@
(cb == Presentation.CB_CACHE_FAILED ?
Logger.ERROR : Logger.MINOR));
sendingData.finalize();
+ routes.terminate();
return new RequestDone(this);
// the StoreInputStream we were reading from got restarted
Index: TransferInsert.java
===================================================================
RCS file:
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsert.java,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -u -r1.9.2.3 -r1.9.2.4
--- TransferInsert.java 23 Aug 2003 13:24:09 -0000 1.9.2.3
+++ TransferInsert.java 28 Aug 2003 17:38:05 -0000 1.9.2.4
@@ -188,6 +188,7 @@
"going to RequestDone for "+this, Logger.DEBUG);
receivingData.cancel();
logFailedTransfer(n);
+ if(routes != null) routes.terminate();
return transition(new RequestDone(this), false);
}
}
@@ -208,6 +209,7 @@
fail(n, "Cache failed");
n.logger.log(this, "Cache failed on commit for "+this, e, Logger.ERROR);
logSuccess(n); // not node's fault
+ if(routes != null) routes.terminate();
transition(new RequestDone(this), false);
}
}
Index: TransferInsertPending.java
===================================================================
RCS file:
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsertPending.java,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -u -r1.14.2.2 -r1.14.2.3
--- TransferInsertPending.java 26 Aug 2003 02:01:04 -0000 1.14.2.2
+++ TransferInsertPending.java 28 Aug 2003 17:38:05 -0000 1.14.2.3
@@ -67,6 +67,7 @@
}
catch (RequestAbortException rae) {
// we are either going to SendingReply or RequestDone with no route found
+ // So don't terminate()!
if(Core.logger.shouldLog(Logger.DEBUG))
Core.logger.log(this, "request abort exception "+searchKey,
rae, Logger.DEBUG);
@@ -152,6 +153,7 @@
} finally {
cleanDoc(); // if nobody is reading, nobody will
}
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
return this; // still waiting for Accepted
@@ -167,6 +169,7 @@
receivingData.cancel();
cleanDoc(); // if nobody is reading, nobody will
+ if(routes != null) routes.terminate();
return new RequestDone(this);
}
Index: TransferReply.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/TransferReply.java,v
retrieving revision 1.11.2.5
retrieving revision 1.11.2.6
diff -u -r1.11.2.5 -r1.11.2.6
--- TransferReply.java 26 Aug 2003 18:42:22 -0000 1.11.2.5
+++ TransferReply.java 28 Aug 2003 17:38:05 -0000 1.11.2.6
@@ -127,6 +127,7 @@
n.logger.log(this, "Cache failed on commit for "+this, e,
Logger.ERROR);
logSuccess(n);
+ if(routes != null) routes.terminate();
transition(new RequestDone(this), false);
}
@@ -149,6 +150,7 @@
"going to RequestDone for "+this, Logger.DEBUG);
receivingData.cancel();
logFailedTransfer(n);
+ if(routes != null) routes.terminate();
return transition(new RequestDone(this), false);
}
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs