Fix piece size calculation
This commit is contained in:
parent
4ca5f9a371
commit
39a09f2704
|
@ -127,11 +127,9 @@ class TorrentMetadata(object):
|
||||||
piece_size = piece_size * 1024
|
piece_size = piece_size * 1024
|
||||||
else:
|
else:
|
||||||
# We need to calculate a piece size
|
# We need to calculate a piece size
|
||||||
psize = 16384
|
piece_size = 16384
|
||||||
while (datasize / psize) > 1024 and psize < 8192 * 1024:
|
while (datasize / piece_size) > 1024 and piece_size < (8192 * 1024):
|
||||||
psize *= 2
|
piece_size *= 2
|
||||||
|
|
||||||
piece_size = psize / 1024
|
|
||||||
|
|
||||||
# Calculate the number of pieces we will require for the data
|
# Calculate the number of pieces we will require for the data
|
||||||
num_pieces = datasize / piece_size
|
num_pieces = datasize / piece_size
|
||||||
|
|
Loading…
Reference in New Issue