summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
+ }
+
}
}