Skip to content

Commit

Permalink
additional asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed May 5, 2024
1 parent 149a7ba commit e387f06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pread_disk_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,9 @@ void pread_disk_io::async_read(storage_index_t storage, peer_request const& r
// this is an aligned read request for one block
if (m_cache.get({ storage, r.piece }, block_idx, [&](span<char const> buf)
{
TORRENT_ASSERT(buf.size() <= read_offset + r.length);
// if this truly is an aligned read, the block-offset should be 0
TORRENT_ASSERT_VAL(read_offset == 0, read_offset);
TORRENT_ASSERT_VAL(buf.size() <= read_offset + r.length, r.length);
buffer = disk_buffer_holder(m_buffer_pool, m_buffer_pool.allocate_buffer("send buffer"), r.length);
if (!buffer)
{
Expand Down

0 comments on commit e387f06

Please sign in to comment.