summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org
diff options
context:
space:
mode:
authorSimon Rettberg2015-07-17 17:25:27 +0200
committerSimon Rettberg2015-07-17 17:25:27 +0200
commit552f88cff3ba319513035af31dda60ee6d40bc8a (patch)
treeb8f43b5972c2adb9af4158372ecfdb04d6aa7bae /dozentenmodulserver/src/main/java/org
parent[client] Add image details window (diff)
downloadtutor-module-552f88cff3ba319513035af31dda60ee6d40bc8a.tar.gz
tutor-module-552f88cff3ba319513035af31dda60ee6d40bc8a.tar.xz
tutor-module-552f88cff3ba319513035af31dda60ee6d40bc8a.zip
[server] Handle cancel() for Uploads, Mark blocks as complete
Diffstat (limited to 'dozentenmodulserver/src/main/java/org')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/ActiveUpload.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/ActiveUpload.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/ActiveUpload.java
index dbeb24ae..49cfed56 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/ActiveUpload.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/fileserv/ActiveUpload.java
@@ -7,7 +7,6 @@ import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.sql.SQLException;
import java.util.List;
-import java.util.UUID;
import java.util.concurrent.ThreadPoolExecutor;
import org.apache.log4j.Logger;
@@ -202,8 +201,10 @@ public class ActiveUpload {
}
public synchronized void cancel() {
- // TODO Auto-generated method stub
-
+ if (download != null) // TODO: Thread safety
+ download.close("Cancelled");
+ if (state != TransferState.FINISHED)
+ state = TransferState.ERROR;
}
/**
@@ -251,6 +252,8 @@ public class ActiveUpload {
if (currentChunk != null) {
// TODO: A chunk was requested before, check hash and requeue if not matching
// This needs to be async (own thread) so will be a little complicated
+ // For now, we just mark it as complete
+ chunks.markSuccessful(currentChunk);
LOGGER.info("There was a previous chunk!");
}
// Get next missing chunk