Author: jflesch
Date: 2006-10-10 17:28:58 +0000 (Tue, 10 Oct 2006)
New Revision: 10656

Modified:
   trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
   trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java
Log:
Fix FCPClientGet

Modified: trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java      2006-10-10 06:18:09 UTC 
(rev 10655)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPClientGet.java      2006-10-10 17:28:58 UTC 
(rev 10656)
@@ -224,7 +224,7 @@
                                                                progress = 99;
                                                                running = true;
                                                                successful = 
false;
-                                                               
saveFileTo(destinationDir);
+                                                               
saveFileTo(destinationDir, false);
                                                        } else {
                                                                status = 
"Available";
                                                                progress = 100;
@@ -498,7 +498,11 @@
                }
        }

-       public synchronized boolean saveFileTo(String dir) {
+       public boolean saveFileTo(String dir) {
+               return this.saveFileTo(dir, true);
+       }
+
+       public synchronized boolean saveFileTo(String dir, boolean checkStatus) 
{
                fromTheNodeProgress = 0;

                if(dir == null) {
@@ -509,7 +513,7 @@
                destinationDir = dir;


-               if(!isFinished() || !isSuccessful()) {
+               if(checkStatus && (!isFinished() || !isSuccessful())) {
                        Logger.warning(this, "Unable to fetch a file not 
finished");
                        return false;
                }
@@ -519,6 +523,8 @@
                        return false;
                }

+               Logger.info(this, "Duplicating socket ...");
+
                duplicatedQueryManager = 
queueManager.getQueryManager().duplicate(identifier);
                duplicatedQueryManager.addObserver(this);

@@ -538,10 +544,7 @@
        }

        public synchronized boolean continueSaveFileTo(String dir) {
-               try {
-                       Thread.sleep(20000);
-               } catch(java.lang.InterruptedException e){
-               }
+
                Logger.info(this, "Asking file '"+filename+"' to the node...");

                destinationDir = dir;

Modified: trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java
===================================================================
--- trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java     2006-10-10 06:18:09 UTC 
(rev 10655)
+++ trunk/apps/Thaw/src/thaw/fcp/FCPConnection.java     2006-10-10 17:28:58 UTC 
(rev 10656)
@@ -263,6 +263,7 @@
                                lastWrite = System.currentTimeMillis();

                                out.write(data);
+                               out.flush();
                        } catch(java.io.IOException e) {
                                Logger.warning(this, "Unable to write() on the 
socket ?! : "+ e.toString()+ " ; "+e.getMessage());
                                disconnect();


Reply via email to