diff options
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serverconnection')
5 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/Connection.java b/src/main/java/org/openslx/imagemaster/serverconnection/Connection.java index 28a9838..bfdb1bb 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/Connection.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/Connection.java @@ -1,5 +1,10 @@ package org.openslx.imagemaster.serverconnection; +/** + * This represents a connection. + * (When a satellite is up- or downloading an image from/to masterserver). + * It is used to help the ConnectionHandler and is storing infos. + */ public class Connection { /** diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java index 0447e68..7fa9c4e 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/ConnectionHandler.java @@ -27,6 +27,7 @@ import org.openslx.imagemaster.Globals; /** * Class to handle all incoming and outgoing connections. + * Also handles the authentication and the saving/delivering of images. */ public class ConnectionHandler implements IncomingEvent { @@ -140,7 +141,7 @@ public class ConnectionHandler implements IncomingEvent long actual; for ( Integer block : blocks ) { actual = block * Globals.blockSize; - uploader.prepareSendRange( actual, ( ( fileSize - actual ) < Globals.blockSize ) ? fileSize : ( block + 1 ) * Globals.blockSize ); + uploader.sendRange( actual, ( ( fileSize - actual ) < Globals.blockSize ) ? fileSize : ( block + 1 ) * Globals.blockSize ); uploader.sendFile( fileName ); } uploader.close(); @@ -186,7 +187,7 @@ public class ConnectionHandler implements IncomingEvent log.debug( "Block " + blockNumber + " was transmitted " + image.getTimesTransmitted( blockNumber ) + " time(s)." ); downloader.setOutputFilename( connections.get( token ).filepath ); - downloader.receiveBinary(); + downloader.readBinary(); } downloader.close(); } diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/CrcScheduler.java b/src/main/java/org/openslx/imagemaster/serverconnection/CrcScheduler.java index 68ae95d..1ad921b 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/CrcScheduler.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/CrcScheduler.java @@ -11,7 +11,8 @@ import org.openslx.imagemaster.Globals; import org.openslx.imagemaster.crcchecker.CrcChecker; /** - * Class to schedule crc checks. + * Class to schedule CRC checks. + * CRC checks of uploading images are so done parallel to the connection. */ public class CrcScheduler extends TimerTask { @@ -25,6 +26,7 @@ public class CrcScheduler extends TimerTask List<UploadingImage> list = ImageProcessor.getImagesToCheck(); log.debug( list ); Iterator<UploadingImage> iter = list.iterator(); + // iterate over the uploading images that need to be checked while ( iter.hasNext() ) { UploadingImage image = iter.next(); log.debug( "Checking blocks of " + image.getDbImage().imageName ); diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java b/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java index 5754a6b..630096f 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java @@ -5,18 +5,13 @@ import java.util.List; import java.util.Map; /** - * Helper class for the ImageProcessor to know some things about the downloading client - * + * Helper class for the ImageProcessor and ConnectionHandler to know some things about the downloading client */ public class DownloadingClient { private final HashMap<String, ImageInfos> downloadingImages = new HashMap<>(); - DownloadingClient() - { - } - public void addDownload( String uuid, List<Integer> list, String token ) { downloadingImages.put( uuid, new ImageInfos( uuid, list, token ) ); diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImage.java b/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImage.java index f290bb6..b0b035b 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImage.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/UploadingImage.java @@ -10,7 +10,7 @@ import org.openslx.imagemaster.crcchecker.ImageFile; import org.openslx.imagemaster.db.DbImage; /** - * Helper class for ImageProcessor to save some infos about the images in the process list. + * Helper class for ImageProcessor and ConnectionHandler to save some infos about the images in the process list. */ public class UploadingImage { |