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

Modified Files:
        ReceivingInsert.java RequestAbortException.java 
        TransferInsertPending.java 
Log Message:
6121:
Fix no StoreData being sent for inserts in ReceivingInsert. Breaks both local and 
final-node inserts.
Try to catch NPE in TWOS earlier.
Logging


Index: ReceivingInsert.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/ReceivingInsert.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ReceivingInsert.java        8 Sep 2003 19:59:42 -0000       1.21
+++ ReceivingInsert.java        6 Oct 2003 15:20:18 -0000       1.22
@@ -22,6 +22,7 @@
     
     ReceivingInsert(InsertPending ancestor) {
         super(ancestor);
+       receivingData = ancestor.receivingData;
     }
     
     ReceivingInsert(AwaitingInsert ancestor) {
@@ -42,7 +43,8 @@
     
     public State receivedMessage(Node n, DataReceived dr) throws BadStateException {
         if (receivingData != dr.source()) {
-            throw new BadStateException("Not my DataReceived: "+dr);
+            throw new BadStateException("Not my DataReceived: "+dr+" ("+
+                                       dr.source()+") vs "+receivingData);
         }
         int cb = dr.getCB();
         switch (cb) {
@@ -75,7 +77,7 @@
                    Routing r = n.rt.route(searchKey, hopsToLive,
                                           length, false, true);
                     ft.storeData(n, r.getNextRoute(), -1, 0, null);
-                   r.terminate(false, false); // duh
+                   terminateRouting(false, false); // duh
                    // We are the terminal node; we cache it
                    if (origPeer != null)
                    {
@@ -88,8 +90,7 @@
                            
n.inboundRequests.incActive(origPeer.getAddress().toString());
                        }
                     }
-                }
-                catch (CommunicationException e) {
+                } catch (CommunicationException e) {
                     n.logger.log(this,
                         "Failed to send back StoreData to peer " + e.peer,
                         e, Logger.MINOR);

Index: RequestAbortException.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/RequestAbortException.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- RequestAbortException.java  13 Jan 2002 05:24:50 -0000      1.1.1.1
+++ RequestAbortException.java  6 Oct 2003 15:20:18 -0000       1.2
@@ -8,4 +8,8 @@
         super();
         state = s;
     }
+    
+    public String toString() {
+       return super.toString()+" for "+state;
+    }
 }

Index: TransferInsertPending.java
===================================================================
RCS file: 
/cvsroot/freenet/freenet/src/freenet/node/states/request/TransferInsertPending.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- TransferInsertPending.java  18 Sep 2003 17:48:12 -0000      1.18
+++ TransferInsertPending.java  6 Oct 2003 15:20:18 -0000       1.19
@@ -67,8 +67,8 @@
             // we are either going to SendingReply or RequestDone with no route found
            // So don't terminate()!
            if(Core.logger.shouldLog(Logger.DEBUG,this))
-               Core.logger.log(this, "request abort exception "+searchKey, 
-                               rae, Logger.DEBUG);
+               Core.logger.log(this, "request abort exception "+searchKey+
+                               " going to "+rae.state, rae, Logger.DEBUG);
             if (receivingData.result() == -1)
                 receivingData.cancel();
             return rae.state;
@@ -125,6 +125,9 @@
             // going to RequestDone with SendFailedException
            // Lost contact with origin node
             receivingData.cancel();
+           if(Core.logger.shouldLog(Logger.DEBUG,this))
+               Core.logger.log(this, "Got RAE: "+rae, rae,
+                               Logger.DEBUG);
            return rae.state;
        } catch (EndOfRouteException e) {
            if(Core.logger.shouldLog(Logger.DEBUG,this))
@@ -252,9 +255,15 @@
         try {
             insertReply(n);
         } catch (RequestAbortException rae) {
+           if(logDEBUG)
+               Core.logger.log(this, "Got "+rae+" in endRoute()",
+                               rae, Logger.DEBUG);
             return rae.state;
         }
         State s = new ReceivingInsert(this);
+       if(logDEBUG)
+           Core.logger.log(this, "Going to "+s+" ("+this+")",
+                           Logger.DEBUG);
         if (dataReceived != null)
             throw new StateTransition(s, dataReceived, true);
         else

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

Reply via email to