From 44e8e879cd3c7e73af7e77de3e2a87b39d0bb366 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 1 Nov 2020 16:25:42 +0000 Subject: [PATCH] allow for multiple downloads of files with same name by appending infohash to incompletes --- .../main/groovy/com/muwire/core/download/Downloader.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy index ef423c7f..43476204 100644 --- a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy @@ -26,6 +26,7 @@ import com.muwire.core.util.DataUtil import com.muwire.core.util.BandwidthCounter import groovy.util.logging.Log +import net.i2p.data.Base64 import net.i2p.data.Destination import net.i2p.util.ConcurrentHashSet @@ -89,8 +90,10 @@ public class Downloader { this.connector = connector this.destinations = destinations this.incompletes = incompletes - this.piecesFile = new File(incompletes, file.getName()+".pieces") - this.incompleteFile = new File(incompletes, file.getName()+".part") + + String ih64 = Base64.encode(infoHash.getRoot()) + this.piecesFile = new File(incompletes, file.getName()+"${ih64}.pieces") + this.incompleteFile = new File(incompletes, file.getName()+"${ih64}.part") this.pieceSizePow2 = pieceSizePow2 this.pieceSize = 1 << pieceSizePow2 this.pieces = pieces