Update of /cvsroot/freenet/freenet/src/freenet/node/states/request
In directory sc8-pr-cvs1:/tmp/cvs-serv17193/src/freenet/node/states/request

Modified Files:
        Pending.java ReceivingInsert.java AwaitingInsert.java 
        ReceivingReply.java RequestState.java 
        TransferInsertPending.java DataPending.java InsertPending.java 
        TransferReply.java TransferInsert.java AwaitingStoreData.java 
Log Message:
6332: Add lots of new diagnostic vars on routing etc, change routingSuccessRatio 
reporting slightly.

Index: Pending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/Pending.java,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -w -r1.81 -r1.82
--- Pending.java        31 Oct 2003 19:26:52 -0000      1.81
+++ Pending.java        13 Nov 2003 16:18:55 -0000      1.82
@@ -129,7 +129,7 @@
         Core.diagnostics.occurrenceCounting("lostRequestState", 1);
        Core.logger.log(this, "Lost a Pending state "+this+" !",
                        new Exception("debug"), Logger.NORMAL);
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
         fail(n, "Request state lost due to overflow for "+this);
     }
     
@@ -199,8 +199,7 @@
        
         ++rejected;
        
-       // Umm, no. Rejecting node should not have any influence
-        hopsToLive = hopsToLive-1;
+        hopsToLive--;
         
        if(logDEBUG)
            Core.logger.log(this, "Rejected count: "+rejected+
@@ -449,11 +448,11 @@
                         "Failed to find data after key collision on "+
                         this+" while caching DataReply",
                         Logger.NORMAL);
-           terminateRouting(false, false); // cache failure? anyway, node not routing
+           terminateRouting(false, false, false); // cache failure? anyway, node not 
routing
             return new RequestDone(this);
        } catch (StoreIOException e) {
            // Our fault
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
            dr.drop(n);
            Core.logger.log(this, "I/O error storing DataReply: "+e+" ("+
                         this+")", e, Logger.ERROR);
@@ -526,7 +525,7 @@
        loggedResult = false;
        
         if (hopsToLive <= 0) {
-           terminateRouting(false, true /* probably! */);
+               terminateRouting(false, origHopsToLive != 0, true);
             throw new EndOfRouteException("Reached last node in route");
        }
        
@@ -562,7 +561,7 @@
                if(logDEBUG)
                    Core.logger.log(this, "rt exhaused for "+this, 
                                 Logger.DEBUG);
-               terminateRouting(false, true);
+               terminateRouting(false, origHopsToLive>0, true);
                throw new RequestAbortException(new RequestDone(this));
            } else {
                if(logDEBUG)
@@ -705,7 +704,7 @@
                                 Logger.MINOR);
                }
                // Either way...
-               terminateRouting(false, false);
+               terminateRouting(false, false, false);
                throw new RequestAbortException(new RequestDone(this));
            }
        } else if(sf == outwardSender) {
@@ -795,7 +794,7 @@
             Core.logger.log(this,
                          "Couldn't restart because relaying QueryRestarted failed: "+
                         e+" for "+this, Logger.MINOR);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             throw new RequestAbortException(new RequestDone(this));
         }
     }
@@ -844,7 +843,7 @@
                    doc.setParent(id, n.ticker().getMessageHandler(),
                                  "Replying with data from store");
                    sendingData = sendData(n, doc);
-                   terminateRouting(true, false);
+                   terminateRouting(true, false, false);
                    long sendingDataTime = System.currentTimeMillis();
                    if(logDEBUG)
                        Core.logger.log(this, "sendData() took "+
@@ -868,13 +867,13 @@
                Core.logger.log(this, "I/O error replying with data on "+this,
                             e, Logger.MINOR);
                thrownTime = System.currentTimeMillis();
-               terminateRouting(false, false);
+               terminateRouting(false, false, false);
                throw new RequestAbortException(new RequestDone(this));
            } catch (CommunicationException e) {
                Core.logger.log(this, "Error replying to peer: "+e+" on "+this, 
                             e, Logger.MINOR);
                thrownTime = System.currentTimeMillis();
-               terminateRouting(false, false);
+               terminateRouting(false, false, false);
                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.27
retrieving revision 1.28
diff -u -w -r1.27 -r1.28
--- ReceivingInsert.java        13 Nov 2003 02:16:59 -0000      1.27
+++ ReceivingInsert.java        13 Nov 2003 16:18:55 -0000      1.28
@@ -86,7 +86,7 @@
                                           length, false, true);
                    ft.storeData(n, r.getNextRoute(), r.lastEstimatorToFieldSet(), -1, 
0, null);
                    // Terminate the routing involved
-                   r.terminate(false, false);
+                   r.terminateNoDiagnostic();
                    
                    // We are the terminal node; we cache it
                    if (origPeer != null)

Index: AwaitingInsert.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/AwaitingInsert.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- AwaitingInsert.java 31 Oct 2003 19:21:17 -0000      1.9
+++ AwaitingInsert.java 13 Nov 2003 16:18:55 -0000      1.10
@@ -53,7 +53,7 @@
             fail(n, "I/O error receiving insert");
             Core.logger.log(this, "Failed to cache insert on chain " 
                         + Long.toHexString(id), e, Logger.ERROR);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             return new RequestDone(this);
         }
         receivingData.schedule(n);
@@ -67,14 +67,14 @@
         Core.logger.log(this, "Did not receive expected DataInsert on chain " 
                            + Long.toHexString(id), Logger.MINOR);
         fail(n, "DataInsert never received");
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
         return new RequestDone(this);
     }
     
     public State receivedMessage(Node n, QueryAborted q) throws StateException {
        Core.logger.log(this, "Aborted AwaitingInsert", Logger.DEBUG);
        if(ni != null) ni.cancel();
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
        return new RequestDone(this);
     }
 }

Index: ReceivingReply.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/ReceivingReply.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- ReceivingReply.java 31 Oct 2003 19:21:17 -0000      1.11
+++ ReceivingReply.java 13 Nov 2003 16:18:55 -0000      1.12
@@ -156,7 +156,7 @@
        
        Core.logger.log(this, "Transitioning to RequestDone from "+this,
                     Logger.DEBUG);
-       terminateRouting(false, true); // routing will ignore if we succeeded already
+       terminateRouting(false, true, false); // routing will ignore if we succeeded 
already
         return new RequestDone(this);
     }
     

Index: RequestState.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/RequestState.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -r1.22 -r1.23
--- RequestState.java   11 Nov 2003 20:57:41 -0000      1.22
+++ RequestState.java   13 Nov 2003 16:18:55 -0000      1.23
@@ -177,14 +177,19 @@
            ",ft="+ft+"@"+System.currentTimeMillis();
     }
     
-    public void terminateRouting(boolean success, boolean routingRelated) {
+    public void terminateRouting(boolean success, boolean routingRelated,
+                                                                boolean endOfRoute) {
        if(!terminatedRouting) {
            terminatedRouting = true;
            if(routes != null) {
-               routes.terminate(success, routingRelated);
+               routes.terminate(success, routingRelated, endOfRoute);
                // Don't null routes. We need it for the storedata.
+               if(routingRelated && !endOfRoute) {
+                       Core.diagnostics.occurrenceContinuous("finalHTL", hopsToLive);
+               }
            } else {
-               TerminatableRouting.staticReallyTerminate(success, routingRelated, 
searchKey);
+               TerminatableRouting.staticReallyTerminate(success, routingRelated, 
+                               endOfRoute, searchKey);
            }
        }
     }

Index: TransferInsertPending.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsertPending.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- TransferInsertPending.java  31 Oct 2003 19:21:17 -0000      1.21
+++ TransferInsertPending.java  13 Nov 2003 16:18:55 -0000      1.22
@@ -182,7 +182,7 @@
                 } finally {
                     cleanDoc(); // if nobody is reading, nobody will
                 }
-               terminateRouting(false, false);
+               terminateRouting(false, false, false);
                 return new RequestDone(this);
         }
         return this;  // still waiting for Accepted
@@ -198,7 +198,7 @@
         receivingData.cancel();
        
         cleanDoc(); // if nobody is reading, nobody will
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
         return new RequestDone(this);
     }
     

Index: DataPending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/DataPending.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- DataPending.java    2 Nov 2003 01:38:26 -0000       1.26
+++ DataPending.java    13 Nov 2003 16:18:55 -0000      1.27
@@ -58,7 +58,8 @@
             super.receivedQueryRejected(n, qr);
         } catch (EndOfRouteException e) {
             dataNotFound(n, System.currentTimeMillis(), true);
-           terminateRouting(false, true); // because routing produced the QR
+           terminateRouting(false, origHopsToLive > 0, true); 
+           // because routing produced the QR
             return new RequestDone(this);
         } catch (RequestAbortException rae) {
            // Might not be a RequestDone - terminate WHEN THROWING
@@ -79,7 +80,7 @@
             super.receivedRequestInitiator(n, ri);
         } catch (EndOfRouteException e) {
             dataNotFound(n, System.currentTimeMillis(), true);
-           terminateRouting(false, true);
+            terminateRouting(false, origHopsToLive>0, true);
             return new RequestDone(this);
         } catch (RequestAbortException rae) {
             return rae.state;
@@ -153,7 +154,7 @@
            dataNotFound(n, System.currentTimeMillis(), true);
            // We don't care if it works
            
-           terminateRouting(false, true);
+           terminateRouting(false, origHopsToLive>0, true);
            return new RequestDone(this);
        }
        return this;
@@ -163,7 +164,7 @@
         long toq = n.ft.shouldFail(searchKey, hopsToLive);
         if ((origPeer != null) && toq > 0) {
             dataNotFound(n, toq, true);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
            // It certainly wasn't *THIS* Routing's fault
            
             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.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- InsertPending.java  31 Oct 2003 19:21:17 -0000      1.26
+++ InsertPending.java  13 Nov 2003 16:18:55 -0000      1.27
@@ -109,7 +109,7 @@
             super.receivedRequestInitiator(n, ri);
        } catch (EndOfRouteException e) {
            // see above
-           terminateRouting(false,true);
+           terminateRouting(false,origHopsToLive>0,true);
             return endRoute(n);
         } catch (RequestAbortException rae) {
             cancelNoInsert();
@@ -146,7 +146,7 @@
         fail(n, "DataInsert never received");
         queryAborted(n);
        // Not our fault, this is from the requester, so don't tell Routing
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
         return new RequestDone(this);
     }
 
@@ -157,7 +157,7 @@
         }
         cancelNoInsert();
         queryAborted(n, qf);
-       terminateRouting(false, false);
+       terminateRouting(false, false, false);
         return new RequestDone(this);
     }
 
@@ -179,7 +179,7 @@
             // propagate QueryAborted upstream in case they
             // are waiting on DataInsert
             queryAborted(n);
-            terminateRouting(false, false);
+            terminateRouting(false, false, false);
            // Won't route again!
             try {
                 searchData(n);
@@ -199,7 +199,7 @@
             Core.logger.log(this, "Failed to cache insert for " + this,
                         e, Logger.ERROR);
             queryAborted(n);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             return new RequestDone(this);
         }
         
@@ -233,7 +233,7 @@
                 Core.logger.log(this, "Failed to cache insert for "+this,
                             e, Logger.ERROR);
             queryAborted(n);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             return new RequestDone(this);
         } finally {
             receivingData.schedule(n);
@@ -307,7 +307,7 @@
     private final State endRoute(Node n) {
         cancelRestart();
 //     logFailure(n);
-       terminateRouting(false, false); // just in case
+       terminateRouting(false, false, false); // just in case
        // Nobody to route it to, so terminate any routing
        
         try {
@@ -350,7 +350,7 @@
             Core.logger.log(this,
                         "Failed to send back InsertReply, dropping for "+
                         this, e, Logger.MINOR);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             throw new RequestAbortException(new RequestDone(this));
         }
     }
@@ -380,7 +380,7 @@
                 Core.logger.log(this, "Failed to read data from store for "+
                             this, e, Logger.ERROR);
 //             }
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
             throw new RequestAbortException(new RequestDone(this));
         }
     }

Index: TransferReply.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/TransferReply.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- TransferReply.java  31 Oct 2003 19:21:17 -0000      1.18
+++ TransferReply.java  13 Nov 2003 16:18:55 -0000      1.19
@@ -156,7 +156,7 @@
                Core.logger.log(this, "dataReceived control bytes not CB_OK, "+
                             "going to RequestDone for "+this, Logger.DEBUG);
            receivingData.cancel();
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
 //         logFailedTransfer(n);
            return transition(new RequestDone(this), false);
        }
@@ -185,7 +185,7 @@
             case Presentation.CB_CACHE_FAILED:
                 Core.logger.log(this, "Cache failed while receiving data! for "+this,
                             Logger.ERROR);
-               terminateRouting(false, false);
+               terminateRouting(false, false, false);
                 // the repercussions will strike in the DataSent..
                // Ignore for NGRouting, our fault
                 break;

Index: TransferInsert.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsert.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -r1.17 -r1.18
--- TransferInsert.java 12 Nov 2003 03:30:03 -0000      1.17
+++ TransferInsert.java 13 Nov 2003 16:18:55 -0000      1.18
@@ -212,7 +212,7 @@
         } catch (IOException e) {
             fail(n, "Cache failed");
             Core.logger.log(this, "Cache failed on commit for "+this, e, 
Logger.ERROR);
-           terminateRouting(false, false); // our fault
+           terminateRouting(false, false, false); // our fault
             transition(new RequestDone(this), false);
         }
     }
@@ -281,7 +281,7 @@
        case Presentation.CB_OK:
            Core.logger.log(this, "Insert transferred successfully! for "+this,
                         Logger.MINOR);
-           terminateRouting(true, true);
+           terminateRouting(true, true, false);
            // The search time is useless because it's a two stage process for 
inserts, and
            // Accepted can be sent with no effort.
            // The transfer rate is useless because it's probably bound by the source 
node.
@@ -294,7 +294,7 @@
        case Presentation.CB_CACHE_FAILED:
            Core.logger.log(this, "Transfer of insert failed, cache broken! for 
"+this, 
                         Logger.ERROR);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
            queryAborted(n);
            break;
            
@@ -315,7 +315,7 @@
            Core.logger.log(this, "Send aborted: "+
                         Presentation.getCBdescription(cb)+", for "+this,
                         Logger.MINOR);
-           terminateRouting(false, false);
+           terminateRouting(false, false, false);
            queryAborted(n);
            // Not routed-to node's fault
            break;

Index: AwaitingStoreData.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/AwaitingStoreData.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -w -r1.29 -r1.30
--- AwaitingStoreData.java      13 Nov 2003 02:16:59 -0000      1.29
+++ AwaitingStoreData.java      13 Nov 2003 16:18:55 -0000      1.30
@@ -56,7 +56,8 @@
         // this is pretty much the same as if it timed out for a DataRequest,
         // but for an insert we need to go back to TransferInsertPending
         if (xferIns == null) {
-           terminateRouting(false, true);
+               Core.diagnostics.occurrenceCounting("routingFailedInAWSD", 1);
+           terminateRouting(false, true, false);
             relayStoreData(n, null);
             return new RequestDone(this);
         } else {
@@ -69,7 +70,9 @@
         if (this.nosd != nosd) {
             throw new BadStateException("Not my NoStoreData: "+nosd);
         }
-       terminateRouting(false, true);
+               Core.diagnostics.occurrenceCounting("routingFailedInAWSD", 1);
+               Core.diagnostics.occurrenceCounting("routingFailedInAWSD", 1);
+       terminateRouting(false, true, false);
         relayStoreData(n, null);
         return new RequestDone(this);
     }
@@ -83,7 +86,7 @@
        
        // Update global network load estimate stats.                       
         n.loadStats.storeTraffic(sd.dataSource(), sd.requestsPerHour());
-       terminateRouting(true, true);
+       terminateRouting(true, true, false);
         relayStoreData(n, sd);
 
         return new RequestDone(this);
@@ -92,7 +95,8 @@
     public final void lost(Node n) {
         Core.diagnostics.occurrenceCounting("lostAwaitingStoreData", 1);
         // just like timing out with the NoStoreData
-       terminateRouting(false, false);
+               Core.diagnostics.occurrenceCounting("routingFailedInAWSD", 1);
+       terminateRouting(false, false, false);
         relayStoreData(n, null);
     }
 

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to