forked from premiere/premiere-libtorrent
fix connection_tester to support generating fake data for arbitrary torrents (#1181)
This commit is contained in:
parent
7a52a285a1
commit
15bf443bfd
|
@ -840,7 +840,8 @@ void generate_data(char const* path, torrent_info const& ti)
|
||||||
for (int j = 0; j < ti.piece_size(i); j += 0x4000)
|
for (int j = 0; j < ti.piece_size(i); j += 0x4000)
|
||||||
{
|
{
|
||||||
generate_block(piece, i, j, 0x4000);
|
generate_block(piece, i, j, 0x4000);
|
||||||
file::iovec_t b = { piece, 0x4000};
|
int const left_in_piece = ti.piece_size(i) - j;
|
||||||
|
file::iovec_t const b = { piece, size_t(std::min(left_in_piece, 0x4000))};
|
||||||
storage_error error;
|
storage_error error;
|
||||||
st->writev(&b, 1, i, j, 0, error);
|
st->writev(&b, 1, i, j, 0, error);
|
||||||
if (error)
|
if (error)
|
||||||
|
|
Loading…
Reference in New Issue