diff options
author | Simon Rettberg | 2016-02-24 17:53:46 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-02-24 17:53:46 +0100 |
commit | 5bb1bb28a784f61d7887e2b281fa9ec16f34f388 (patch) | |
tree | f9c5cfd42c4c684aa8ec7372ee3fffedb6671971 /dozentenmodul/src/main/java/org | |
parent | [client] Add cd-rom drives to downloaded machine (diff) | |
download | tutor-module-5bb1bb28a784f61d7887e2b281fa9ec16f34f388.tar.gz tutor-module-5bb1bb28a784f61d7887e2b281fa9ec16f34f388.tar.xz tutor-module-5bb1bb28a784f61d7887e2b281fa9ec16f34f388.zip |
[client] Better handling of server side errors on upload
Diffstat (limited to 'dozentenmodul/src/main/java/org')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java index bff973b5..71c7add8 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/filetransfer/UploadTask.java @@ -96,7 +96,10 @@ public class UploadTask extends TransferTask { remoteError = null; consecutiveInitFails.set(0); } else { - remoteError = uploader.getRemoteError(); + String err = uploader.getRemoteError(); + if (err != null) { + remoteError = err; + } consecutiveInitFails.incrementAndGet(); } transferEnded(this, ret); @@ -143,18 +146,20 @@ public class UploadTask extends TransferTask { speed += thread.getCurrentSpeed(); } } - // 0 = complete, 1 = missing, 2 = uploading, 3 = queued for copying, 4 = copying - if (blocks != null) { - int missing = 0; - for (byte b : blocks) { - if (b != 0) { - missing++; + if (speed != 0) { + // 0 = complete, 1 = missing, 2 = uploading, 3 = queued for copying, 4 = copying, 5 = hashing + if (blocks != null) { + int missing = 0; + for (byte b : blocks) { + if (b != 0) { + missing++; + } } + final long bytesRemaining = CHUNK_SIZE * (long) missing; + timeRemaining = (1000 * bytesRemaining) / (speed + 1); } - final long bytesRemaining = CHUNK_SIZE * (long) missing; - timeRemaining = (1000 * bytesRemaining) / (speed + 1); } - if (error == null && remoteError != null) { + if (remoteError != null && (error == null || remoteError.equals("Out of disk space"))) { error = remoteError; } TransferEvent event = new TransferEvent(state, blocks, speed, timeRemaining, error); |