Author: toad
Date: 2008-04-05 13:21:04 +0000 (Sat, 05 Apr 2008)
New Revision: 19016

Modified:
   trunk/freenet/src/freenet/node/SSKInsertSender.java
Log:
The other part of Daniel Cheng's synchronization patch.
I am not going to make status volatile, as we sync on every access.

Modified: trunk/freenet/src/freenet/node/SSKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-04-05 13:19:33 UTC 
(rev 19015)
+++ trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-04-05 13:21:04 UTC 
(rev 19016)
@@ -506,6 +506,7 @@

     private void finish(int code, PeerNode next) {
        if(logMINOR) Logger.minor(this, "Finished: "+code+" on "+this, new 
Exception("debug"));
+       synchronized(this) {
         if(status != NOT_FINISHED)
                throw new IllegalStateException("finish() called with "+code+" 
when was already "+status);

@@ -514,11 +515,10 @@

         status = code;

-        synchronized(this) {
             notifyAll();
         }

-        if(status == SUCCESS && next != null)
+        if(code == SUCCESS && next != null)
                next.onSuccess(true, true);

         if(logMINOR) Logger.minor(this, "Set status code: "+getStatusString());


Reply via email to