diff options
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java')
| -rw-r--r-- | src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java b/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java index 0acfa42..5754a6b 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/DownloadingClient.java @@ -2,6 +2,7 @@ package org.openslx.imagemaster.serverconnection; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Helper class for the ImageProcessor to know some things about the downloading client @@ -10,7 +11,7 @@ import java.util.List; public class DownloadingClient { - public final HashMap<String, ImageInfos> downloadingImages = new HashMap<>(); + private final HashMap<String, ImageInfos> downloadingImages = new HashMap<>(); DownloadingClient() { @@ -36,11 +37,12 @@ public class DownloadingClient return (downloadingImages.size() > 0); } - public List<Integer> getLastRequestedBlocks( String uuid ) + public List<Integer> getLastRequestedBlocks( String token ) { - if ( !downloadingImages.containsKey( uuid ) ) - return null; - return downloadingImages.get( uuid ).lastRequestedBlocks; + for (Map.Entry<String, ImageInfos> entry : downloadingImages.entrySet() ) { + if (entry.getValue().token.equals( token )) return entry.getValue().lastRequestedBlocks; + } + return null; } public void requestBlocks( String uuid, List<Integer> list ) @@ -59,7 +61,6 @@ public class DownloadingClient class ImageInfos { - public final String uuid; public final String token; private List<Integer> lastRequestedBlocks; |
