Author: nextgens
Date: 2006-05-23 20:31:49 +0000 (Tue, 23 May 2006)
New Revision: 8839

Modified:
   trunk/freenet/src/freenet/node/NodeUpdater.java
Log:
Doh

Modified: trunk/freenet/src/freenet/node/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeUpdater.java     2006-05-23 20:31:30 UTC 
(rev 8838)
+++ trunk/freenet/src/freenet/node/NodeUpdater.java     2006-05-23 20:31:49 UTC 
(rev 8839)
@@ -294,14 +294,19 @@
                        System.out.println("################## File written! 
"+cg.getURI().getSuggestedEdition()+ " " +f.getAbsolutePath());

                        File f2 = new File("freenet-cvs-snapshot.jar");
+                       f2.delete();
+                       
                        if(f.renameTo(f2)){
                                if(node.getNodeStarter()!=null)
                                        node.getNodeStarter().restart();
-                               else
+                               else{
+                                       System.out.println("New version has 
been downloaded: please restart your node!");
                                        node.exit();
+                               }       
                        }else
                                System.out.println("ERROR renaming the file!");

+                       
                }catch(Exception e){
                        Logger.error(this, "Error while updating the node : 
"+e);
                        System.out.println("Exception : "+e);
@@ -317,9 +322,18 @@

        public synchronized void onFailure(FetchException e, ClientGetter 
state) {
                this.cg = state;
+               int errorCode = e.getMode();

                cg.cancel();
-               maybeUpdate();
+               if(errorCode == FetchException.DATA_NOT_FOUND ||
+                               errorCode == FetchException.ROUTE_NOT_FOUND ||
+                               errorCode == FetchException.PERMANENT_REDIRECT 
||
+                               errorCode == FetchException.REJECTED_OVERLOAD){
+                       
+                       Logger.normal(this, "Rescheduling new request");
+                       maybeUpdate();
+               }else
+                       Logger.error(this, "Canceling fetch : "+ 
e.getMessage());
        }

        public void onSuccess(BaseClientPutter state) {


Reply via email to