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

Modified Files:
      Tag: ngrouting
        AwaitingStoreData.java DataPending.java InsertPending.java 
        Pending.java ReceivingInsert.java RequestState.java 
        SendingReply.java TransferInsert.java 
Log Message:
7050: Fix a race in ConnectionOpener that was probably the source of the RNFs. Sort 
the routing table display in nodestatus. Add a parameter to route() to indicate 
whether the request is an insert. Get rid of now redundant pWildLegitDNF in NGRT. 
Change routing termination again esp w.r.t. inserts. Don't null routes, we need it for 
the StoreData. Catch anything thrown by process() when running maintqueue in RSL. 
Indenting. Logging.


Index: AwaitingStoreData.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/AwaitingStoreData.java,v
retrieving revision 1.21.2.3
retrieving revision 1.21.2.4
diff -u -r1.21.2.3 -r1.21.2.4
--- AwaitingStoreData.java      20 Aug 2003 18:09:22 -0000      1.21.2.3
+++ AwaitingStoreData.java      30 Aug 2003 19:49:52 -0000      1.21.2.4
@@ -56,10 +56,10 @@
         // 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);
             relayStoreData(n, null);
             return new RequestDone(this);
-        }
-        else {
+        } else {
             if (nosd != null) nosd.cancel();
             return xferIns.receivedMessage(n, qr);
         }
@@ -69,6 +69,7 @@
         if (this.nosd != nosd) {
             throw new BadStateException("Not my NoStoreData: "+nosd);
         }
+       terminateRouting(false, true);
         relayStoreData(n, null);
         return new RequestDone(this);
     }
@@ -82,6 +83,7 @@
        
        // Update global network load estimate stats.                       
         n.loadStats.storeTraffic(sd.dataSource(), sd.requestsPerHour());
+       terminateRouting(true, true);
         relayStoreData(n, sd);
 
         return new RequestDone(this);
@@ -90,6 +92,7 @@
     public final void lost(Node n) {
         Core.diagnostics.occurrenceCounting("lostAwaitingStoreData", 1);
         // just like timing out with the NoStoreData
+       terminateRouting(false, false);
         relayStoreData(n, null);
     }
 

Index: DataPending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/DataPending.java,v
retrieving revision 1.14.6.4
retrieving revision 1.14.6.5
diff -u -r1.14.6.4 -r1.14.6.5
--- DataPending.java    29 Aug 2003 18:58:06 -0000      1.14.6.4
+++ DataPending.java    30 Aug 2003 19:49:52 -0000      1.14.6.5
@@ -159,6 +159,10 @@
                         " for "+this, Logger.MINOR);
         }
     }
+    
+    protected boolean isInsert() {
+       return false;
+    }
 }
 
 

Index: InsertPending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/InsertPending.java,v
retrieving revision 1.17.2.4
retrieving revision 1.17.2.5
diff -u -r1.17.2.4 -r1.17.2.5
--- InsertPending.java  29 Aug 2003 18:58:06 -0000      1.17.2.4
+++ InsertPending.java  30 Aug 2003 19:49:52 -0000      1.17.2.5
@@ -386,6 +386,10 @@
        if(logDEBUG) n.logger.log(this, "Scheduled "+sendingData+" for "+this,
                                  Logger.DEBUG);
     }
+    
+    protected boolean isInsert() {
+       return true;
+    }
 }
 
 

Index: Pending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/Pending.java,v
retrieving revision 1.47.2.11
retrieving revision 1.47.2.12
diff -u -r1.47.2.11 -r1.47.2.12
--- Pending.java        29 Aug 2003 22:43:39 -0000      1.47.2.11
+++ Pending.java        30 Aug 2003 19:49:52 -0000      1.47.2.12
@@ -164,10 +164,16 @@
         hopsToLive = (int) Math.min(hopsToLive-1, qr.hopsToLive);
         
        if(logDEBUG)
-           n.logger.log(this, "Rejected count: "+rejected+", current hopsToLive: "+
+           n.logger.log(this, "Rejected count: "+rejected+
+                        ", current hopsToLive: "+
                         hopsToLive+" for "+this, Logger.DEBUG);
        
-        routes.queryRejected(qr.source.isCached(), qr.attenuation);
+       if(routes == null) {
+           n.logger.log(this, "Already terminated in "+this+
+                        ".receivedQueryRejected!", Logger.NORMAL);
+       } else {
+           routes.queryRejected(qr.source.isCached(), qr.attenuation);
+       }
        long toldRTTime = System.currentTimeMillis();
        if(logDEBUG)
            n.logger.log(this, "Time to inform RT: "+toldRTTime+" for "+
@@ -255,7 +261,7 @@
                                this, Logger.DEBUG);
            routes = n.rt.route(searchKey, hopsToLive, 
                                searchKey.getExpectedTransmissionLength(),
-                               false);
+                               false, isInsert());
            gotRouteTime = System.currentTimeMillis();
            n.diagnostics.occurrenceContinuous("getRouteTime", gotRouteTime - 
searchDataTime);
            if((gotRouteTime - searchDataTime) > 1000)
@@ -287,13 +293,13 @@
             // decrease contact probability for node that didn't reply
             if (lastPeer != null)
                 routes.timedOut();
-
+           
             // Don't allow indefinite restarts.
             //
             // Note:
             // sendOn will throw an EndOfRouteException below
             // if hopsToLive hits 0.
-
+           
             if (--hopsToLive > 0) {
                 // send QueryRestarted to initiating chain
                 relayRestarted(n, Core.hopTime(hopsToLive + 1));
@@ -312,7 +318,9 @@
         // Requests should actually not carry unknown fields... 
         sendOn(n, createRequest(null, n.myRef), true);
     }
-
+    
+    protected abstract boolean isInsert();
+    
     /**
      * Because method selection on superclasses doesn't work,
      * implementation must call this from a method with the actual

Index: ReceivingInsert.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/ReceivingInsert.java,v
retrieving revision 1.17.6.5
retrieving revision 1.17.6.6
diff -u -r1.17.6.5 -r1.17.6.6
--- ReceivingInsert.java        29 Aug 2003 23:27:39 -0000      1.17.6.5
+++ ReceivingInsert.java        30 Aug 2003 19:49:53 -0000      1.17.6.6
@@ -73,7 +73,7 @@
                        getTransmissionLength(length, 
                                              searchKey.getPartSize(length));
                    Routing r = n.rt.route(searchKey, hopsToLive,
-                                          length, false);
+                                          length, false, true);
                     ft.storeData(n, r.getNextRoute(), -1, 0, null);
                    r.terminate(false, false); // duh
                    // We are the terminal node; we cache it

Index: RequestState.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/RequestState.java,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -r1.11.2.1 -r1.11.2.2
--- RequestState.java   29 Aug 2003 18:58:06 -0000      1.11.2.1
+++ RequestState.java   30 Aug 2003 19:49:53 -0000      1.11.2.2
@@ -154,7 +154,7 @@
     public void terminateRouting(boolean success, boolean routingRelated) {
        if(routes != null) {
            routes.terminate(success, routingRelated);
-           routes = null;
+           // Don't null routes. We need it for the storedata.
        }
     }
 }

Index: SendingReply.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/SendingReply.java,v
retrieving revision 1.18.6.5
retrieving revision 1.18.6.6
diff -u -r1.18.6.5 -r1.18.6.6
--- SendingReply.java   29 Aug 2003 23:27:39 -0000      1.18.6.5
+++ SendingReply.java   30 Aug 2003 19:49:53 -0000      1.18.6.6
@@ -54,7 +54,7 @@
                        getTransmissionLength(length, 
                                              searchKey.getPartSize(length));
                    Routing r = n.rt.route(searchKey, hopsToLive,
-                                          length, false);
+                                          length, false, false);
                     ft.storeData(n, r.getNextRoute(), -1, 0,
                                 new RequestSendCallback("StoreData", n, this));
                    r.terminate(false, false); // duhh :)

Index: TransferInsert.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsert.java,v
retrieving revision 1.9.2.6
retrieving revision 1.9.2.7
diff -u -r1.9.2.6 -r1.9.2.7
--- TransferInsert.java 30 Aug 2003 01:23:01 -0000      1.9.2.6
+++ TransferInsert.java 30 Aug 2003 19:49:53 -0000      1.9.2.7
@@ -265,7 +265,8 @@
            if(acceptedTime <= 0) {
                n.logger.log(this, "acceptedTime not set yet!: "+this,
                             Logger.NORMAL);
-               terminateRouting(false, false);
+//             terminateRouting(false, false);
+               // Could be restarted even in AWSD! Inserts are wierd...
                break;
            }
            if(insertReplyTime <= 0) {

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

Reply via email to