forked from I2P_Developers/i2p.i2p
i2psnark: Fix torrent ignoring priority settings when autostart is enabled (ticket #2229)
This commit is contained in:
@ -300,20 +300,25 @@ public class Snark
|
||||
|
||||
/**
|
||||
* multitorrent
|
||||
*
|
||||
* Will not start itself. Caller must call startTorrent() if desired.
|
||||
*
|
||||
* @throws RuntimeException via fatal()
|
||||
*/
|
||||
public Snark(I2PSnarkUtil util, String torrent, String ip, int user_port,
|
||||
StorageListener slistener, CoordinatorListener clistener,
|
||||
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
|
||||
ConnectionAcceptor connectionAcceptor, boolean start, String rootDir)
|
||||
ConnectionAcceptor connectionAcceptor, String rootDir)
|
||||
{
|
||||
this(util, torrent, ip, user_port, slistener, clistener, complistener,
|
||||
peerCoordinatorSet, connectionAcceptor, start, rootDir, null);
|
||||
peerCoordinatorSet, connectionAcceptor, rootDir, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* multitorrent
|
||||
*
|
||||
* Will not start itself. Caller must call startTorrent() if desired.
|
||||
*
|
||||
* @param baseFile if null, use rootDir/torrentName; if non-null, use it instead
|
||||
* @throws RuntimeException via fatal()
|
||||
* @since 0.9.11
|
||||
@ -321,7 +326,7 @@ public class Snark
|
||||
public Snark(I2PSnarkUtil util, String torrent, String ip, int user_port,
|
||||
StorageListener slistener, CoordinatorListener clistener,
|
||||
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
|
||||
ConnectionAcceptor connectionAcceptor, boolean start, String rootDir, File baseFile)
|
||||
ConnectionAcceptor connectionAcceptor, String rootDir, File baseFile)
|
||||
{
|
||||
if (slistener == null)
|
||||
slistener = this;
|
||||
@ -482,14 +487,13 @@ public class Snark
|
||||
savedUploaded = (completeListener != null) ? completeListener.getSavedUploaded(this) : 0;
|
||||
if (completeListener != null)
|
||||
_comments = completeListener.getSavedComments(this);
|
||||
|
||||
if (start)
|
||||
startTorrent();
|
||||
}
|
||||
|
||||
/**
|
||||
* multitorrent, magnet
|
||||
*
|
||||
* Will not start itself. Caller must call startTorrent() if desired.
|
||||
*
|
||||
* @param torrent a fake name for now (not a file name)
|
||||
* @param ih 20-byte info hash
|
||||
* @param trackerURL may be null
|
||||
@ -498,7 +502,7 @@ public class Snark
|
||||
*/
|
||||
public Snark(I2PSnarkUtil util, String torrent, byte[] ih, String trackerURL,
|
||||
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
|
||||
ConnectionAcceptor connectionAcceptor, boolean start, String rootDir)
|
||||
ConnectionAcceptor connectionAcceptor, String rootDir)
|
||||
{
|
||||
completeListener = complistener;
|
||||
_util = util;
|
||||
@ -516,9 +520,6 @@ public class Snark
|
||||
// All we have is an infoHash
|
||||
// meta remains null
|
||||
// storage remains null
|
||||
|
||||
if (start)
|
||||
startTorrent();
|
||||
}
|
||||
|
||||
private static byte[] generateID() {
|
||||
|
@ -1555,11 +1555,13 @@ public class SnarkManager implements CompleteListener, ClientApp {
|
||||
_log.info("New Snark, torrent: " + filename + " base: " + baseFile);
|
||||
torrent = new Snark(_util, filename, null, -1, null, null, this,
|
||||
_peerCoordinatorSet, _connectionAcceptor,
|
||||
shouldAutoStart(), dataDir.getPath(), baseFile);
|
||||
dataDir.getPath(), baseFile);
|
||||
loadSavedFilePriorities(torrent);
|
||||
synchronized (_snarks) {
|
||||
_snarks.put(filename, torrent);
|
||||
}
|
||||
if (shouldAutoStart())
|
||||
torrent.startTorrent();
|
||||
} catch (IOException ioe) {
|
||||
// close before rename/delete for windows
|
||||
if (fis != null) try { fis.close(); fis = null; } catch (IOException ioe2) {}
|
||||
@ -1660,7 +1662,7 @@ public class SnarkManager implements CompleteListener, ClientApp {
|
||||
String dirPath = dataDir != null ? dataDir.getAbsolutePath() : getDataDir().getPath();
|
||||
Snark torrent = new Snark(_util, name, ih, trackerURL, listener,
|
||||
_peerCoordinatorSet, _connectionAcceptor,
|
||||
false, dirPath);
|
||||
dirPath);
|
||||
|
||||
synchronized (_snarks) {
|
||||
Snark snark = getTorrentByInfoHash(ih);
|
||||
|
@ -72,7 +72,7 @@ public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnabl
|
||||
public FetchAndAdd(I2PAppContext ctx, SnarkManager mgr, String url, File dataDir) {
|
||||
// magnet constructor
|
||||
super(mgr.util(), "Torrent download",
|
||||
null, null, null, null, null, false, null);
|
||||
null, null, null, null, null, null);
|
||||
_ctx = ctx;
|
||||
_log = ctx.logManager().getLog(FetchAndAdd.class);
|
||||
_mgr = mgr;
|
||||
|
@ -3914,7 +3914,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
} catch (Throwable t) { t.printStackTrace(); }
|
||||
}
|
||||
}
|
||||
snark.updatePiecePriorities();
|
||||
snark.updatePiecePriorities();
|
||||
_manager.saveTorrentStatus(snark);
|
||||
}
|
||||
|
||||
|
10
history.txt
10
history.txt
@ -1,6 +1,14 @@
|
||||
2018-06-09 zzz
|
||||
* eepsite: Fix up help page in prep for translation (ticket #2214)
|
||||
* i2psnark: Fix torrent ignoring priority settings when
|
||||
autostart is enabled (ticket #2229)
|
||||
|
||||
2018-06-02 zzz
|
||||
* Console: Sort tunnels within pools by expiration (ticket #2232)
|
||||
* NTCP: Refactor EstablishState in prep for NTCP2
|
||||
* NTCP:
|
||||
- Refactor EstablishState in prep for NTCP2
|
||||
- Initial NTCP2 RI and payload code, disabled for now
|
||||
- Fix state lock, should not have been static
|
||||
|
||||
2018-06-01 zzz
|
||||
* SusiDNS: Fix deleting notes (ticket #1433)
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 17;
|
||||
public final static long BUILD = 18;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user