Compare commits
9 Commits
muwire-0.3
...
muwire-0.3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
14ee35e77a | ||
![]() |
8773eb4ee0 | ||
![]() |
51425bbfd9 | ||
![]() |
6a4879bc0b | ||
![]() |
e7fe56439b | ||
![]() |
2886feab4a | ||
![]() |
fb91194026 | ||
![]() |
4527478b0d | ||
![]() |
b0062f146e |
@@ -35,7 +35,7 @@ class Cli {
|
|||||||
|
|
||||||
Core core
|
Core core
|
||||||
try {
|
try {
|
||||||
core = new Core(props, home, "0.3.7")
|
core = new Core(props, home, "0.3.9")
|
||||||
} catch (Exception bad) {
|
} catch (Exception bad) {
|
||||||
bad.printStackTrace(System.out)
|
bad.printStackTrace(System.out)
|
||||||
println "Failed to initialize core, exiting"
|
println "Failed to initialize core, exiting"
|
||||||
|
@@ -53,7 +53,7 @@ class CliDownloader {
|
|||||||
|
|
||||||
Core core
|
Core core
|
||||||
try {
|
try {
|
||||||
core = new Core(props, home, "0.3.7")
|
core = new Core(props, home, "0.3.9")
|
||||||
} catch (Exception bad) {
|
} catch (Exception bad) {
|
||||||
bad.printStackTrace(System.out)
|
bad.printStackTrace(System.out)
|
||||||
println "Failed to initialize core, exiting"
|
println "Failed to initialize core, exiting"
|
||||||
|
@@ -297,7 +297,7 @@ public class Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Core core = new Core(props, home, "0.3.7")
|
Core core = new Core(props, home, "0.3.9")
|
||||||
core.startServices()
|
core.startServices()
|
||||||
|
|
||||||
// ... at the end, sleep or execute script
|
// ... at the end, sleep or execute script
|
||||||
|
@@ -75,7 +75,7 @@ class DownloadSession {
|
|||||||
if (available.isEmpty())
|
if (available.isEmpty())
|
||||||
piece = pieces.claim()
|
piece = pieces.claim()
|
||||||
else
|
else
|
||||||
piece = pieces.claim(available)
|
piece = pieces.claim(new HashSet<>(available))
|
||||||
if (piece == -1)
|
if (piece == -1)
|
||||||
return false
|
return false
|
||||||
boolean unclaim = true
|
boolean unclaim = true
|
||||||
|
@@ -18,6 +18,7 @@ import com.muwire.core.DownloadedFile
|
|||||||
import com.muwire.core.EventBus
|
import com.muwire.core.EventBus
|
||||||
import com.muwire.core.connection.I2PConnector
|
import com.muwire.core.connection.I2PConnector
|
||||||
import com.muwire.core.files.FileDownloadedEvent
|
import com.muwire.core.files.FileDownloadedEvent
|
||||||
|
import com.muwire.core.util.DataUtil
|
||||||
|
|
||||||
import groovy.util.logging.Log
|
import groovy.util.logging.Log
|
||||||
import net.i2p.data.Destination
|
import net.i2p.data.Destination
|
||||||
@@ -269,7 +270,7 @@ public class Downloader {
|
|||||||
writePieces()
|
writePieces()
|
||||||
}
|
}
|
||||||
} catch (Exception bad) {
|
} catch (Exception bad) {
|
||||||
log.log(Level.WARNING,"Exception while downloading",bad)
|
log.log(Level.WARNING,"Exception while downloading",DataUtil.findRoot(bad))
|
||||||
} finally {
|
} finally {
|
||||||
currentState = WorkerState.FINISHED
|
currentState = WorkerState.FINISHED
|
||||||
if (pieces.isComplete() && eventFired.compareAndSet(false, true)) {
|
if (pieces.isComplete() && eventFired.compareAndSet(false, true)) {
|
||||||
|
@@ -8,6 +8,7 @@ import com.muwire.core.Persona
|
|||||||
import com.muwire.core.download.Pieces
|
import com.muwire.core.download.Pieces
|
||||||
import com.muwire.core.download.SourceDiscoveredEvent
|
import com.muwire.core.download.SourceDiscoveredEvent
|
||||||
import com.muwire.core.files.FileManager
|
import com.muwire.core.files.FileManager
|
||||||
|
import com.muwire.core.util.DataUtil
|
||||||
|
|
||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
import groovy.json.JsonSlurper
|
import groovy.json.JsonSlurper
|
||||||
@@ -50,7 +51,7 @@ class MeshManager {
|
|||||||
Mesh mesh = meshes.get(e.infoHash)
|
Mesh mesh = meshes.get(e.infoHash)
|
||||||
if (mesh == null)
|
if (mesh == null)
|
||||||
return
|
return
|
||||||
if (mesh.sources.add(e.source))
|
mesh.sources.add(e.source)
|
||||||
save()
|
save()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ class MeshManager {
|
|||||||
json.infoHash = Base64.encode(mesh.infoHash.getRoot())
|
json.infoHash = Base64.encode(mesh.infoHash.getRoot())
|
||||||
json.sources = mesh.sources.stream().map({it.toBase64()}).collect(Collectors.toList())
|
json.sources = mesh.sources.stream().map({it.toBase64()}).collect(Collectors.toList())
|
||||||
json.nPieces = mesh.pieces.nPieces
|
json.nPieces = mesh.pieces.nPieces
|
||||||
|
json.xHave = DataUtil.encodeXHave(mesh.pieces.downloaded, mesh.pieces.nPieces)
|
||||||
writer.println(JsonOutput.toJson(json))
|
writer.println(JsonOutput.toJson(json))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,6 +91,9 @@ class MeshManager {
|
|||||||
mesh.sources.add(persona)
|
mesh.sources.add(persona)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (json.xHave != null)
|
||||||
|
DataUtil.decodeXHave(json.xHave).each { pieces.markDownloaded(it) }
|
||||||
|
|
||||||
if (!mesh.sources.isEmpty())
|
if (!mesh.sources.isEmpty())
|
||||||
meshes.put(infoHash, mesh)
|
meshes.put(infoHash, mesh)
|
||||||
}
|
}
|
||||||
|
@@ -109,4 +109,10 @@ class DataUtil {
|
|||||||
}
|
}
|
||||||
available
|
available
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Exception findRoot(Exception e) {
|
||||||
|
while(e.getCause() != null)
|
||||||
|
e = e.getCause()
|
||||||
|
e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ public class SharedFile {
|
|||||||
long length = file.length();
|
long length = file.length();
|
||||||
int rawPieceSize = 0x1 << pieceSize;
|
int rawPieceSize = 0x1 << pieceSize;
|
||||||
int rv = (int) (length / rawPieceSize);
|
int rv = (int) (length / rawPieceSize);
|
||||||
if (length % pieceSize != 0)
|
if (length % rawPieceSize != 0)
|
||||||
rv++;
|
rv++;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
group = com.muwire
|
group = com.muwire
|
||||||
version = 0.3.7
|
version = 0.3.9
|
||||||
groovyVersion = 2.4.15
|
groovyVersion = 2.4.15
|
||||||
slf4jVersion = 1.7.25
|
slf4jVersion = 1.7.25
|
||||||
spockVersion = 1.1-groovy-2.4
|
spockVersion = 1.1-groovy-2.4
|
||||||
|
@@ -35,7 +35,7 @@ handlers= java.util.logging.FileHandler
|
|||||||
|
|
||||||
# default file output is in user's home directory.
|
# default file output is in user's home directory.
|
||||||
java.util.logging.FileHandler.pattern = MuWire.log
|
java.util.logging.FileHandler.pattern = MuWire.log
|
||||||
java.util.logging.FileHandler.limit = 50000000
|
java.util.logging.FileHandler.limit = 150000000
|
||||||
java.util.logging.FileHandler.count = 1
|
java.util.logging.FileHandler.count = 1
|
||||||
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
||||||
|
|
||||||
@@ -60,3 +60,5 @@ java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$
|
|||||||
# messages:
|
# messages:
|
||||||
com.xyz.foo.level = SEVERE
|
com.xyz.foo.level = SEVERE
|
||||||
com.muwire.core.level = FINE
|
com.muwire.core.level = FINE
|
||||||
|
net.i2p.client.streaming.impl.level = FINE
|
||||||
|
net.i2p.client.impl.level = FINE
|
||||||
|
Reference in New Issue
Block a user