I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 515a9b8d authored by zzz's avatar zzz
Browse files

i2psnark: Fix 'left' amount in announce exceeding size

and causing tracker error on initial announce
parent 52958b95
No related branches found
No related tags found
No related merge requests found
......@@ -279,7 +279,6 @@ class PeerCoordinator implements PeerListener
/**
* Bytes not yet in storage. Does NOT account for skipped files.
* Not exact (does not adjust for last piece size).
* Returns how many bytes are still needed to get the complete torrent.
* @return -1 if in magnet mode
*/
......@@ -287,8 +286,13 @@ class PeerCoordinator implements PeerListener
{
if (metainfo == null | storage == null)
return -1;
// XXX - Only an approximation.
return ((long) storage.needed()) * metainfo.getPieceLength(0);
int psz = metainfo.getPieceLength(0);
long rv = ((long) storage.needed()) * psz;
int last = metainfo.getPieces() - 1;
BitField bf = storage.getBitField();
if (bf != null && !bf.get(last))
rv -= psz - metainfo.getPieceLength(last);
return rv;
}
/**
......
2022-05-17 zzz
* i2psnark: Fix remaining size calculation causing tracker errors
2022-05-11 zzz
* Transport: Fix thrashing of UPnP IPv6 listen sockets
* Util: Rename modified apache classes (Gitlab ticket #353)
......
......@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 18;
public final static long BUILD = 19;
/** for example "-test" */
public final static String EXTRA = "-rc";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment