use span for picker_log_alert

This commit is contained in:
arvidn 2018-11-02 10:46:16 +01:00 committed by Arvid Norberg
parent 014533da12
commit bf496c6b14
3 changed files with 6 additions and 6 deletions

View File

@ -2675,7 +2675,7 @@ TORRENT_VERSION_NAMESPACE_2
// internal
picker_log_alert(aux::stack_allocator& alloc, torrent_handle const& h
, tcp::endpoint const& ep, peer_id const& peer_id, picker_flags_t flags
, piece_block const* blocks, int num_blocks);
, span<piece_block const> blocks);
TORRENT_DEFINE_ALERT(picker_log_alert, 89)

View File

@ -2220,12 +2220,12 @@ namespace {
picker_log_alert::picker_log_alert(aux::stack_allocator& alloc, torrent_handle const& h
, tcp::endpoint const& ep, peer_id const& peer_id, picker_flags_t const flags
, piece_block const* blocks, int num_blocks)
, span<piece_block const> blocks)
: peer_alert(alloc, h, ep, peer_id)
, picker_flags(flags)
, m_array_idx(alloc.copy_buffer({reinterpret_cast<char const*>(blocks)
, aux::numeric_cast<std::size_t>(num_blocks) * sizeof(piece_block)}))
, m_num_blocks(num_blocks)
, m_array_idx(alloc.copy_buffer({reinterpret_cast<char const*>(blocks.data())
, blocks.size() * int(sizeof(piece_block))}))
, m_num_blocks(int(blocks.size()))
{}
std::vector<piece_block> picker_log_alert::blocks() const

View File

@ -175,7 +175,7 @@ namespace libtorrent {
&& !interesting_pieces.empty())
{
t.alerts().emplace_alert<picker_log_alert>(t.get_handle(), c.remote()
, c.pid(), flags, &interesting_pieces[0], int(interesting_pieces.size()));
, c.pid(), flags, interesting_pieces);
}
c.peer_log(peer_log_alert::info, "PIECE_PICKER"
, "prefer_contiguous: %d picked: %d"