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

Modified Files:
        Pending.java 
Log Message:
An if(logDEBUG) and some indenting

Index: Pending.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/states/request/Pending.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- Pending.java        8 Oct 2003 22:54:18 -0000       1.65
+++ Pending.java        9 Oct 2003 15:08:56 -0000       1.66
@@ -490,137 +490,136 @@
     
     private void sendOn(Node n, Request r, boolean isFirst)
        throws EndOfRouteException, RequestAbortException {
-       
-       loggedResult = false;
+
+               loggedResult = false;
        
         if (hopsToLive <= 0) {
-           terminateRouting(false, true /* probably! */);
+               terminateRouting(false, true /* probably! */);
             throw new EndOfRouteException("Reached last node in route");
-       }
+               }
        
-        
         Peer addr = null;
         NodeReference nr;
        
         int attemptCount = 0;
-       while (true) { // until the send doesn't fail
-           if(logDEBUG)
-               n.logger.log(this, "Still trying to route "+searchKey+"("+
-                            this+"), attempt "+attemptCount, Logger.DEBUG);
-           if(routes == null) {
-               nr = null; // terminated
-               n.logger.log(this, "Already terminated but trying to route!: "+this,
-                            Logger.NORMAL);
-           } else nr = routes.getNextRoute();
-           if(logDEBUG) n.logger.log(this, "Got next route for "+this,
-                                     Logger.DEBUG);
-           long stillInSendOnTime = System.currentTimeMillis();
-           if(isFirst && attemptCount == 0) {
-               n.diagnostics.occurrenceContinuous("stillInSendOnTime", 
-                                                  stillInSendOnTime - 
-                                                  gotRouteTime);
-               if(logDEBUG) n.logger.log(this, "stillInSendOnTime="+
-                                         (stillInSendOnTime - gotRouteTime)+
-                                         " for "+this, Logger.DEBUG);
-           }
+               while (true) { // until the send doesn't fail
+                   if(logDEBUG)
+                               n.logger.log(this, "Still trying to route 
"+searchKey+"("+
+                                    this+"), attempt "+attemptCount, Logger.DEBUG);
+                   if(routes == null) {
+                               nr = null; // terminated
+                               n.logger.log(this, "Already terminated but trying to 
route!: "+this,Logger.NORMAL);
+                   } else
+                       nr = routes.getNextRoute();
+                   if(logDEBUG) n.logger.log(this, "Got next route for "+this,
+                                             Logger.DEBUG);
+                   long stillInSendOnTime = System.currentTimeMillis();
+                   if(isFirst && attemptCount == 0) {
+                               
n.diagnostics.occurrenceContinuous("stillInSendOnTime", 
+                                                          stillInSendOnTime - 
+                                                          gotRouteTime);
+                               if(logDEBUG) n.logger.log(this, "stillInSendOnTime="+
+                                                 (stillInSendOnTime - gotRouteTime)+
+                                                 " for "+this, Logger.DEBUG);
+                   }
             if (nr == null) {
-               if(logDEBUG)
-                   n.logger.log(this, "Ran out of routes for "+this+" after "+
-                                attemptCount+" tries.", Logger.DEBUG);
-                fail(n, "No route found", r.otherFields);
-               if(logDEBUG)
-                   n.logger.log(this, "rt exhaused for "+this, 
-                                Logger.DEBUG);
-               terminateRouting(false, true);
-                throw new RequestAbortException(new RequestDone(this));
-            } else {
-               if(logDEBUG)
-                   n.logger.log(this, "Got a route for "+this,
-                                Logger.DEBUG);
-           }
-            addr = n.getPeer(nr);
-           if(logDEBUG) n.logger.log(this, "Got peer "+addr+" for "+this,
-                                     Logger.DEBUG);
-           long stillStillInSendOnTime = System.currentTimeMillis();
-           if(isFirst && attemptCount == 0) {
-               n.diagnostics.occurrenceContinuous("stillStillInSendOnTime", 
-                                                  stillStillInSendOnTime - 
-                                                  stillInSendOnTime);
-           }
-            if (addr == null) {  // bad node ref
-                // or, one we just don't have a transport for?
-                //n.logger.log(this,
-                //    "Found bad node ref while routing, removing: "+nr,
-                //    Logger.MINOR);
-                //n.rt.dereference(nr.getIdentity());
-               if(logDEBUG)
-                   n.logger.log(this, this+": Route address is NULL!", 
-                                Logger.DEBUG);
-               routes.ignoreRoute();
-                continue;
-            }
-            if (origPeer != null && origPeer.equalsIdent(addr)) {
-                // funnily enough, this happens quite often
-                // and results in some pretty dumb "loops"
-               if(logDEBUG)
-                   n.logger.log(this, this+": Route is self",
-                                Logger.DEBUG);
-               routes.ignoreRoute();
-                continue;
-            }
-           if(logDEBUG) n.logger.log(this, "Still here after origPeer checks: "+
+                               if(logDEBUG)
+                                   n.logger.log(this, "Ran out of routes for "+this+" 
after "+
+                                                attemptCount+" tries.", Logger.DEBUG);
+                               fail(n, "No route found", r.otherFields);
+                               if(logDEBUG)
+                                   n.logger.log(this, "rt exhaused for "+this, 
+                                                Logger.DEBUG);
+                               terminateRouting(false, true);
+                               throw new RequestAbortException(new RequestDone(this));
+                       } else {
+                               if(logDEBUG)
+                                   n.logger.log(this, "Got a route for "+this,
+                                                Logger.DEBUG);
+                           }
+                               addr = n.getPeer(nr);
+                           if(logDEBUG) n.logger.log(this, "Got peer "+addr+" for 
"+this,
+                                                     Logger.DEBUG);
+                           long stillStillInSendOnTime = System.currentTimeMillis();
+                           if(isFirst && attemptCount == 0) {
+                                       
n.diagnostics.occurrenceContinuous("stillStillInSendOnTime", 
+                                                                  
stillStillInSendOnTime - 
+                                                                  stillInSendOnTime);
+                           }
+               if (addr == null) {  // bad node ref
+                       // or, one we just don't have a transport for?
+                       //n.logger.log(this,
+                       //    "Found bad node ref while routing, removing: "+nr,
+                       //    Logger.MINOR);
+                       //n.rt.dereference(nr.getIdentity());
+                                       if(logDEBUG)
+                                           n.logger.log(this, this+": Route address 
is NULL!", 
+                                                        Logger.DEBUG);
+                                       routes.ignoreRoute();
+                                       continue;
+                               }
+                               if (origPeer != null && origPeer.equalsIdent(addr)) {
+                                       // funnily enough, this happens quite often
+                                       // and results in some pretty dumb "loops"
+                                       if(logDEBUG)
+                                           n.logger.log(this, this+": Route is self",
+                                                        Logger.DEBUG);
+                                       routes.ignoreRoute();
+                                       continue;
+                               }
+                               if(logDEBUG) n.logger.log(this, "Still here after 
origPeer checks: "+
                                      this, Logger.DEBUG);
-           routedTime = System.currentTimeMillis();
-           if(logDEBUG)
-               n.logger.log(this, "Forwarding query "+this+" to "+
-                            addr+" at "+routedTime, Logger.DEBUG);
-            try {
-                if (attemptCount == 0 && receivedTime > 0 &&
-                    receivedTime < routedTime) { // sanity
-                   long rt = routedTime - receivedTime;
-                    n.diagnostics.occurrenceContinuous("routingTime", rt);
-                   if(rt > 1000 && logDEBUG)
-                       n.logger.log(this, "routingTime "+rt+" for "+
-                                    this, new Exception("debug"), 
-                                    Logger.DEBUG);
-                   n.diagnostics.occurrenceContinuous("subRoutingTime",
-                                                      routedTime - 
-                                                      stillStillInSendOnTime);
-                   if(searchDataRoutingTime > 0)
-                       n.diagnostics.occurrenceContinuous("searchDataRoutingTime", 
-                                                          searchDataRoutingTime);
-                   receivedTime = -2; // make sure we aren't called twice
-                }
-                attemptCount++;
+                       routedTime = System.currentTimeMillis();
+                       if(logDEBUG)
+                                       n.logger.log(this, "Forwarding query "+this+" 
to "+
+                                       addr+" at "+routedTime, Logger.DEBUG);
+               try {
+                       if (attemptCount == 0 && receivedTime > 0 &&
+                       receivedTime < routedTime) { // sanity
+                                       long rt = routedTime - receivedTime;
+                       n.diagnostics.occurrenceContinuous("routingTime", rt);
+                                       if(rt > 1000 && logDEBUG)
+                                                       n.logger.log(this, 
"routingTime "+rt+" for "+
+                                               this, new Exception("debug"), 
+                                               Logger.DEBUG);
+                                       
n.diagnostics.occurrenceContinuous("subRoutingTime",
+                                                       routedTime - 
+                                                       stillStillInSendOnTime);
+                                       if(searchDataRoutingTime > 0)
+                                               
n.diagnostics.occurrenceContinuous("searchDataRoutingTime", 
+                                                                  
searchDataRoutingTime);
+                                       receivedTime = -2; // make sure we aren't 
called twice
+                    }
+                       attemptCount++;
                
-               outwardIdentityLastUsed = nr.getIdentity();
-               outwardSender = new SendFinished(n, id, r.toString());
-               if(logDEBUG) Core.logger.log(this, "Sending message "+r+" on "
-                                            +nr+" for "+this+": "+outwardSender,
-                                            Logger.DEBUG);
-               n.sendMessageAsync(r, nr, outwardSender);
-               
-               // We only wait 1 hop time for accepted. Sending should take much less 
time.
-               n.schedule(Core.hopTime(1), outwardSender);
-               if(logDEBUG) Core.logger.log(this, "Sent message "+r+" on "+
+                                       outwardIdentityLastUsed = nr.getIdentity();
+                                       outwardSender = new SendFinished(n, id, 
r.toString());
+                                       if(logDEBUG) Core.logger.log(this, "Sending 
message "+r+" on "
+                                                            +nr+" for "+this+": 
"+outwardSender,
+                                                            Logger.DEBUG);
+                                       n.sendMessageAsync(r, nr, outwardSender);
+                               
+                                       // We only wait 1 hop time for accepted. 
Sending should take much less time.
+                                       n.schedule(Core.hopTime(1), outwardSender);
+                                       if(logDEBUG) Core.logger.log(this, "Sent 
message "+r+" on "+
                                             nr+" for "+this, Logger.DEBUG);
-                break;
-            } catch (CommunicationException e) {
-                ++unreachable;
-                // don't care if it's terminal or nonterminal
-                // because routing is too time-critical
-               if(logDEBUG)
-                   n.logger.log(this, "Routing ("+this+") failure to: "
-                                +e.peerAddress() + " -- " + e, e, 
-                                Logger.DEBUG);
-                if (e instanceof AuthenticationFailedException) {
-                    routes.authFailed();
-                } else {
-                   // Conn is dead
-                    routes.connectFailed();
-                }
-            }
-        }
+                                       break;
+                               } catch (CommunicationException e) {
+                                       ++unreachable;
+                                       // don't care if it's terminal or nonterminal
+                                       // because routing is too time-critical
+                                       if(logDEBUG)
+                                       n.logger.log(this, "Routing ("+this+") failure 
to: "
+                                               +e.peerAddress() + " -- " + e, e, 
+                                               Logger.DEBUG);
+                       if (e instanceof AuthenticationFailedException) {
+                       routes.authFailed();
+                       } else {
+                                       // Conn is dead
+                       routes.connectFailed();
+                       }
+               }
+               }
        
         // Count outbound Requests.
         n.diagnostics.occurrenceBinomial("outboundAggregateRequests", attemptCount, 
1);
@@ -760,8 +759,9 @@
       * unrecoverable error.  Does nothing if the key is not found.
       */
     void searchData(Node n) throws RequestAbortException {
-       n.logger.log(this, "searchData() on "+this,
-                    new Exception("debug"), Logger.DEBUG);
+               if(logDEBUG)
+                       n.logger.log(this, "searchData() on "+this,
+                       new Exception("debug"), Logger.DEBUG);
        long startTime = System.currentTimeMillis();
        long thrownTime = -1;
         KeyInputStream doc = null;

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

Reply via email to