forked from I2P_Developers/i2p.i2p
i2psnark: Revert API changes that broke i2psnark-rpc plugin
compile-tested only
This commit is contained in:
@ -489,6 +489,21 @@ public class Snark
|
||||
_comments = completeListener.getSavedComments(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* multitorrent, magnet, Used by snark-rpc plugin
|
||||
*
|
||||
* Will not start itself. Caller must call startTorrent() if desired.
|
||||
*
|
||||
* @param ignored used to be autostart
|
||||
* @throws RuntimeException via fatal()
|
||||
* @since 0.8.4, removed in 0.9.36, restored in 0.9.45 with boolean param now ignored
|
||||
*/
|
||||
protected Snark(I2PSnarkUtil util, String torrent, byte[] ih, String trackerURL,
|
||||
CompleteListener complistener, PeerCoordinatorSet peerCoordinatorSet,
|
||||
ConnectionAcceptor connectionAcceptor, boolean ignored, String rootDir) {
|
||||
this(util, torrent, ih, trackerURL, complistener, peerCoordinatorSet, connectionAcceptor, rootDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* multitorrent, magnet
|
||||
*
|
||||
|
@ -426,14 +426,24 @@ public class Storage implements Closeable
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* For efficiency, calculate remaining bytes for all files at once
|
||||
*
|
||||
* @return number of bytes remaining for each file, use indexOf() to get index for a file
|
||||
* @since 0.9.23
|
||||
*/
|
||||
public long[] remaining() {
|
||||
return remaining2()[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* For efficiency, calculate remaining bytes for all files at once.
|
||||
* Remaining bytes is rv[0]. Preview bytes is rv[1].
|
||||
*
|
||||
* @return number of bytes remaining and number of bytes available for a preview for each file, use indexOf() to get index for a file
|
||||
* @since 0.9.23
|
||||
* @since 0.9.45
|
||||
*/
|
||||
public long[][] remaining() {
|
||||
public long[][] remaining2() {
|
||||
long[] rv = new long[_torrentFiles.size()];
|
||||
long[] pv = new long[_torrentFiles.size()];
|
||||
long[][] rva = new long[][] { rv, pv };
|
||||
|
@ -3375,7 +3375,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
List<Sorters.FileAndIndex> fileList = new ArrayList<Sorters.FileAndIndex>(ls.length);
|
||||
// precompute remaining for all files for efficiency
|
||||
long[][] arrays = (storage != null) ? storage.remaining() : null;
|
||||
long[][] arrays = (storage != null) ? storage.remaining2() : null;
|
||||
long[] remainingArray = (arrays != null) ? arrays[0] : null;
|
||||
long[] previewArray = (arrays != null) ? arrays[1] : null;
|
||||
for (int i = 0; i < ls.length; i++) {
|
||||
@ -3764,7 +3764,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
return null;
|
||||
List<Sorters.FileAndIndex> fileList = new ArrayList<Sorters.FileAndIndex>(ls.length);
|
||||
// precompute remaining for all files for efficiency
|
||||
long[] remainingArray = (storage != null) ? storage.remaining()[0] : null;
|
||||
long[] remainingArray = (storage != null) ? storage.remaining() : null;
|
||||
for (int i = 0; i < ls.length; i++) {
|
||||
fileList.add(new Sorters.FileAndIndex(ls[i], storage, remainingArray));
|
||||
}
|
||||
|
Reference in New Issue
Block a user