Author: toad
Date: 2008-02-07 23:20:43 +0000 (Thu, 07 Feb 2008)
New Revision: 17685

Modified:
   trunk/freenet/src/freenet/node/NodeDispatcher.java
Log:
Lock and unlock the UID i.e. actually count the GetOfferedKey handlers running

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-02-07 23:18:41 UTC 
(rev 17684)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-02-07 23:20:43 UTC 
(rev 17685)
@@ -196,6 +196,8 @@

                // Do we want it? We can RejectOverload if we don't have the 
bandwidth...
                boolean isSSK = key instanceof NodeSSK;
+               node.lockUID(uid, isSSK, false, true);
+               try {
                boolean needPubKey = m.getBoolean(DMT.NEED_PUB_KEY);
                String reject = 
                        nodeStats.shouldRejectRequest(true, false, isSSK, 
false, true, source);
@@ -207,7 +209,6 @@
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (overload) data 
request from "+source.getPeer()+": "+e);
                        }
-                       node.unlockUID(uid, isSSK, false, false, false);
                        return true;
                }

@@ -218,6 +219,9 @@
                } catch (NotConnectedException e) {
                        // Too bad.
                }
+               } finally {
+                       node.unlockUID(uid, isSSK, false, false, true);
+               }
                return true;
        }



Reply via email to