Author: toad
Date: 2007-08-22 19:38:17 +0000 (Wed, 22 Aug 2007)
New Revision: 14839

Modified:
   trunk/freenet/src/freenet/node/LocationManager.java
Log:
Log when it's too big.

Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 19:36:49 UTC 
(rev 14838)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 19:38:17 UTC 
(rev 14839)
@@ -740,9 +740,14 @@
             return true;
         }
         if(logMINOR) Logger.minor(this, "SwapRequest from "+pn+" - uid="+uid);
-        int htl = Math.min(m.getInt(DMT.HTL),SWAP_MAX_HTL)-1;
+        int htl = m.getInt(DMT.HTL);
+        if(htl > SWAP_MAX_HTL) {
+               Logger.error(this, "Bogus swap HTL: "+htl+" from "+pn+" 
uid="+uid);
+               htl = SWAP_MAX_HTL;
+        }
+        htl--;
         // Either forward it or handle it
-        if(htl == 0) {
+        if(htl <= 0) {
                if(logMINOR) Logger.minor(this, "Accepting?... "+uid);
             // Accept - handle locally
             if(!lock()) {


Reply via email to