summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2023-07-10 14:34:34 +0200
committerSimon Rettberg2023-07-10 14:34:34 +0200
commit8c7d35f605fc0f8ff50136fb83c31d42a85b82aa (patch)
treeaeccae306593d605dbb87ab60c8598ce1333d069
parent[libvirt] Catch non-critical exception in cleanup (diff)
downloadmaster-sync-shared-8c7d35f605fc0f8ff50136fb83c31d42a85b82aa.tar.gz
master-sync-shared-8c7d35f605fc0f8ff50136fb83c31d42a85b82aa.tar.xz
master-sync-shared-8c7d35f605fc0f8ff50136fb83c31d42a85b82aa.zip
[filetransfer] Improve error logging
-rw-r--r--src/main/java/org/openslx/filetransfer/Downloader.java8
-rw-r--r--src/main/java/org/openslx/filetransfer/FileRange.java6
-rw-r--r--src/main/java/org/openslx/filetransfer/Transfer.java16
3 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/filetransfer/Downloader.java b/src/main/java/org/openslx/filetransfer/Downloader.java
index b2dbbd1..c79810d 100644
--- a/src/main/java/org/openslx/filetransfer/Downloader.java
+++ b/src/main/java/org/openslx/filetransfer/Downloader.java
@@ -203,8 +203,12 @@ public class Downloader extends Transfer
return false;
}
FileRange remoteRange = meta.getRange();
- if ( remoteRange == null || !remoteRange.equals( requestedRange ) ) {
- log.error( "Confirmed range by remote peer does not match requested range, aborting download." );
+ if ( remoteRange == null ) {
+ log.error( "Remote metadata does not contain range confirmation. " + meta );
+ }
+ if ( !remoteRange.equals( requestedRange ) ) {
+ log.error( "Confirmed range by remote peer (" + remoteRange
+ + ") does not match requested range (" + requestedRange + "), aborting download." );
return false;
}
// Receive requested range
diff --git a/src/main/java/org/openslx/filetransfer/FileRange.java b/src/main/java/org/openslx/filetransfer/FileRange.java
index e8a7d12..ed86e51 100644
--- a/src/main/java/org/openslx/filetransfer/FileRange.java
+++ b/src/main/java/org/openslx/filetransfer/FileRange.java
@@ -64,4 +64,10 @@ public class FileRange
return (int)startOffset ^ Integer.rotateLeft( (int)endOffset, 16 ) ^ (int)(startOffset >> 32);
}
+ @Override
+ public String toString()
+ {
+ return startOffset + "-" + endOffset;
+ }
+
}
diff --git a/src/main/java/org/openslx/filetransfer/Transfer.java b/src/main/java/org/openslx/filetransfer/Transfer.java
index 933e63e..4b15e60 100644
--- a/src/main/java/org/openslx/filetransfer/Transfer.java
+++ b/src/main/java/org/openslx/filetransfer/Transfer.java
@@ -9,6 +9,7 @@ import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
@@ -417,6 +418,21 @@ public abstract class Transfer
return meta.containsKey( "COMPRESS" );
}
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ for ( Entry<String, String> it : meta.entrySet() ) {
+ if ( sb.length() != 0 ) {
+ sb.append( ' ' );
+ }
+ sb.append( it.getKey() );
+ sb.append( '=' );
+ sb.append( it.getValue() );
+ }
+ return sb.toString();
+ }
+
}
}