summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Petretti2014-08-28 15:17:08 +0200
committerMichael Petretti2014-08-28 15:17:08 +0200
commit339e454b61746062614cba8b5ba4e41ec6ae4a39 (patch)
tree09825bc1f513db74fc838b6628dc0712bda50d8c
parentAdded comments for better documentation. (diff)
downloadsatellite-daemon-339e454b61746062614cba8b5ba4e41ec6ae4a39.tar.gz
satellite-daemon-339e454b61746062614cba8b5ba4e41ec6ae4a39.tar.xz
satellite-daemon-339e454b61746062614cba8b5ba4e41ec6ae4a39.zip
step back to old but currently working code
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/FileDownloadWorker.java13
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/FileUploadWorker.java13
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." );
}