forked from I2P_Developers/i2p.i2p
I2PSnark: Fix torrent-stopping (#766)
This commit is contained in:
@ -624,6 +624,11 @@ public class Snark
|
|||||||
if (pc != null)
|
if (pc != null)
|
||||||
pc.halt();
|
pc.halt();
|
||||||
Storage st = storage;
|
Storage st = storage;
|
||||||
|
if (!fast)
|
||||||
|
// HACK: Needed a way to distinguish between user-stop and
|
||||||
|
// shutdown-stop. stopTorrent(true) is in stopAllTorrents().
|
||||||
|
// (#766)
|
||||||
|
stopped = true;
|
||||||
if (st != null) {
|
if (st != null) {
|
||||||
// TODO: Cache the config-in-mem to compare vs config-on-disk
|
// TODO: Cache the config-in-mem to compare vs config-on-disk
|
||||||
// (needed for auto-save to not double-save in some cases)
|
// (needed for auto-save to not double-save in some cases)
|
||||||
@ -638,7 +643,9 @@ public class Snark
|
|||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stopped = true;
|
if (fast)
|
||||||
|
// HACK: See above if(!fast)
|
||||||
|
stopped = true;
|
||||||
if (pc != null && _peerCoordinatorSet != null)
|
if (pc != null && _peerCoordinatorSet != null)
|
||||||
_peerCoordinatorSet.remove(pc);
|
_peerCoordinatorSet.remove(pc);
|
||||||
if (_peerCoordinatorSet == null)
|
if (_peerCoordinatorSet == null)
|
||||||
|
@ -105,7 +105,7 @@ public class SnarkManager implements CompleteListener {
|
|||||||
public static final String PROP_FILES_PUBLIC = "i2psnark.filesPublic";
|
public static final String PROP_FILES_PUBLIC = "i2psnark.filesPublic";
|
||||||
public static final String PROP_OLD_AUTO_START = "i2snark.autoStart"; // oops
|
public static final String PROP_OLD_AUTO_START = "i2snark.autoStart"; // oops
|
||||||
public static final String PROP_AUTO_START = "i2psnark.autoStart"; // convert in migration to new config file
|
public static final String PROP_AUTO_START = "i2psnark.autoStart"; // convert in migration to new config file
|
||||||
public static final String DEFAULT_AUTO_START = "true";
|
public static final String DEFAULT_AUTO_START = "false";
|
||||||
//public static final String PROP_LINK_PREFIX = "i2psnark.linkPrefix";
|
//public static final String PROP_LINK_PREFIX = "i2psnark.linkPrefix";
|
||||||
//public static final String DEFAULT_LINK_PREFIX = "file:///";
|
//public static final String DEFAULT_LINK_PREFIX = "file:///";
|
||||||
public static final String PROP_STARTUP_DELAY = "i2psnark.startupDelay";
|
public static final String PROP_STARTUP_DELAY = "i2psnark.startupDelay";
|
||||||
@ -1438,7 +1438,6 @@ public class SnarkManager implements CompleteListener {
|
|||||||
Snark snark = getTorrentByInfoHash(metainfo.getInfoHash());
|
Snark snark = getTorrentByInfoHash(metainfo.getInfoHash());
|
||||||
if (snark != null) {
|
if (snark != null) {
|
||||||
addMessage(_("Torrent with this info hash is already running: {0}", snark.getBaseName()));
|
addMessage(_("Torrent with this info hash is already running: {0}", snark.getBaseName()));
|
||||||
saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0, false); // no file priorities
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0, true); // no file priorities
|
saveTorrentStatus(metainfo, bitfield, null, baseFile, true, 0, true); // no file priorities
|
||||||
@ -2129,7 +2128,7 @@ public class SnarkManager implements CompleteListener {
|
|||||||
try {
|
try {
|
||||||
// Snark.fatal() throws a RuntimeException
|
// Snark.fatal() throws a RuntimeException
|
||||||
// don't let one bad torrent kill the whole loop
|
// don't let one bad torrent kill the whole loop
|
||||||
addTorrent(name, null, !shouldAutoStart());
|
addTorrent(name, null, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
addMessage(_("Error: Could not add the torrent {0}", name) + ": " + e);
|
addMessage(_("Error: Could not add the torrent {0}", name) + ": " + e);
|
||||||
_log.error("Unable to add the torrent " + name, e);
|
_log.error("Unable to add the torrent " + name, e);
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 15;
|
public final static long BUILD = 16;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
@ -68,7 +68,7 @@ class IterativeLookupJob extends JobImpl {
|
|||||||
}
|
}
|
||||||
RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(peer);
|
RouterInfo ri = getContext().netDb().lookupRouterInfoLocally(peer);
|
||||||
if (ri == null) {
|
if (ri == null) {
|
||||||
// Take it on faith that its ff to speed things up, we don't need the RI
|
// Take it on faith that it's ff to speed things up, we don't need the RI
|
||||||
// to query it.
|
// to query it.
|
||||||
// Zero-hop outbound tunnel will be failed in ISJ.sendQuery()
|
// Zero-hop outbound tunnel will be failed in ISJ.sendQuery()
|
||||||
_search.newPeerToTry(peer);
|
_search.newPeerToTry(peer);
|
||||||
|
Reference in New Issue
Block a user