Commit 5441874 1 parent 7f4566c commit 5441874 Copy full SHA for 5441874
File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
2
2
1.1.5 release
3
3
4
+ * fix integer overflow in whole_pieces_threshold logic
4
5
* fix uTP path MTU discovery issue on windows (DF bit was not set correctly)
5
6
* fix python binding for torrent_handle, to be hashable
6
7
* fix IPv6 tracker support by performing the second announce in more cases
Original file line number Diff line number Diff line change @@ -110,12 +110,16 @@ namespace libtorrent
110
110
111
111
int prefer_contiguous_blocks = c.prefer_contiguous_blocks ();
112
112
113
- if (prefer_contiguous_blocks == 0 && !time_critical_mode)
113
+ if (prefer_contiguous_blocks == 0
114
+ && !time_critical_mode
115
+ && t.settings ().get_int (settings_pack::whole_pieces_threshold) > 0 )
114
116
{
115
- int blocks_per_piece = t.torrent_file ().piece_length () / t.block_size ();
116
- prefer_contiguous_blocks = c.statistics ().download_payload_rate ()
117
- * t.settings ().get_int (settings_pack::whole_pieces_threshold)
118
- > t.torrent_file ().piece_length () ? blocks_per_piece : 0 ;
117
+ int const blocks_per_piece = t.torrent_file ().piece_length () / t.block_size ();
118
+ prefer_contiguous_blocks
119
+ = (c.statistics ().download_payload_rate ()
120
+ > t.torrent_file ().piece_length ()
121
+ / t.settings ().get_int (settings_pack::whole_pieces_threshold))
122
+ ? blocks_per_piece : 0 ;
119
123
}
120
124
121
125
// if we prefer whole pieces, the piece picker will pick at least
You can’t perform that action at this time.
0 commit comments