forked from premiere/premiere-libtorrent
fix integer overflow in whole_pieces_threshold logic
This commit is contained in:
parent
7f4566c694
commit
5441874f10
|
@ -1,6 +1,7 @@
|
|||
|
||||
1.1.5 release
|
||||
|
||||
* fix integer overflow in whole_pieces_threshold logic
|
||||
* fix uTP path MTU discovery issue on windows (DF bit was not set correctly)
|
||||
* fix python binding for torrent_handle, to be hashable
|
||||
* fix IPv6 tracker support by performing the second announce in more cases
|
||||
|
|
|
@ -110,12 +110,16 @@ namespace libtorrent
|
|||
|
||||
int prefer_contiguous_blocks = c.prefer_contiguous_blocks();
|
||||
|
||||
if (prefer_contiguous_blocks == 0 && !time_critical_mode)
|
||||
if (prefer_contiguous_blocks == 0
|
||||
&& !time_critical_mode
|
||||
&& t.settings().get_int(settings_pack::whole_pieces_threshold) > 0)
|
||||
{
|
||||
int blocks_per_piece = t.torrent_file().piece_length() / t.block_size();
|
||||
prefer_contiguous_blocks = c.statistics().download_payload_rate()
|
||||
* t.settings().get_int(settings_pack::whole_pieces_threshold)
|
||||
> t.torrent_file().piece_length() ? blocks_per_piece : 0;
|
||||
int const blocks_per_piece = t.torrent_file().piece_length() / t.block_size();
|
||||
prefer_contiguous_blocks
|
||||
= (c.statistics().download_payload_rate()
|
||||
> t.torrent_file().piece_length()
|
||||
/ t.settings().get_int(settings_pack::whole_pieces_threshold))
|
||||
? blocks_per_piece : 0;
|
||||
}
|
||||
|
||||
// if we prefer whole pieces, the piece picker will pick at least
|
||||
|
|
Loading…
Reference in New Issue