From 339e454b61746062614cba8b5ba4e41ec6ae4a39 Mon Sep 17 00:00:00 2001 From: Michael Petretti Date: Thu, 28 Aug 2014 15:17:08 +0200 Subject: step back to old but currently working code --- .../satellitedaemon/filetransfer/FileDownloadWorker.java | 13 +++---------- .../satellitedaemon/filetransfer/FileUploadWorker.java | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java index e0f9baf..f912698 100644 --- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java +++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java @@ -1,6 +1,5 @@ package org.openslx.satellitedaemon.filetransfer; -import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -32,19 +31,13 @@ public class FileDownloadWorker implements Runnable { } Downloader d; - try { - d = new Downloader(Globals.getMasterserverHost(), - downInfos.port, Globals.getMasterServerSslContext()); - } catch (IOException e) { - log.warn("Could not connect for download: " + e.toString()); - e.printStackTrace(); - continue; - } + d = new Downloader(Globals.getMasterserverHost(), + downInfos.port, Globals.getMasterServerSslContext()); d.sendToken(downInfos.token); d.setOutputFilename(Globals.getImageFolder() + "/" + image.name + ".vmdk"); // TODO: how should images be saved? while (d.readMetaData()) // TODO: Request range... - d.receiveBinary(); + d.readBinary(); } try { Thread.sleep(5 * 60 * 1000); diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java index 2677c53..61d4072 100644 --- a/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java +++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java @@ -1,7 +1,6 @@ package org.openslx.satellitedaemon.filetransfer; import java.io.File; -import java.io.IOException; import java.util.List; import java.util.UUID; @@ -52,14 +51,8 @@ public class FileUploadWorker implements Runnable // creating the uploader with the "context"-item. Uploader u; - try { - u = new Uploader( Globals.getMasterserverHost(), - upInfos.port, Globals.getMasterServerSslContext() ); - } catch ( IOException e ) { - log.warn( "Could not connect for uploading an image: " - + e.toString() ); - continue; - } + u = new Uploader( Globals.getMasterserverHost(), + upInfos.port, Globals.getMasterServerSslContext() ); // Necessary authentication before upload. u.sendToken( upInfos.token ); @@ -77,7 +70,7 @@ public class FileUploadWorker implements Runnable int endOffset = startOffset + Globals.BLOCKSIZE; if ( endOffset > fileSize ) endOffset = (int)fileSize; // TODO: Long - u.prepareSendRange( startOffset, endOffset ); + u.sendRange( startOffset, endOffset ); u.sendFile( image.path ); log.info( "Block number " + blocks.get( i ) + " uploaded." ); } -- cgit v1.2.3-55-g7522