added some asserts
This commit is contained in:
parent
d7c30bc01b
commit
d1addf876a
|
@ -2151,6 +2151,7 @@ namespace libtorrent
|
||||||
// update m_file_progress
|
// update m_file_progress
|
||||||
TORRENT_ASSERT(m_picker);
|
TORRENT_ASSERT(m_picker);
|
||||||
TORRENT_ASSERT(!have_piece(index));
|
TORRENT_ASSERT(!have_piece(index));
|
||||||
|
TORRENT_ASSERT(!m_picker->have_piece(index));
|
||||||
|
|
||||||
const int piece_size = m_torrent_file->piece_length();
|
const int piece_size = m_torrent_file->piece_length();
|
||||||
size_type off = size_type(index) * piece_size;
|
size_type off = size_type(index) * piece_size;
|
||||||
|
@ -2195,6 +2196,17 @@ namespace libtorrent
|
||||||
|
|
||||||
TORRENT_ASSERT(index >= 0);
|
TORRENT_ASSERT(index >= 0);
|
||||||
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
|
TORRENT_ASSERT(index < m_torrent_file->num_pieces());
|
||||||
|
#ifdef TORRENT_DEBUG
|
||||||
|
// make sure all blocks were successfully written before we
|
||||||
|
// declare the piece has "we have".
|
||||||
|
piece_picker::downloading_piece dp;
|
||||||
|
m_picker->piece_info(index, dp);
|
||||||
|
int blocks_in_piece = m_picker->blocks_in_piece(index);
|
||||||
|
TORRENT_ASSERT(dp.finished == blocks_in_piece);
|
||||||
|
TORRENT_ASSERT(dp.writing == 0);
|
||||||
|
TORRENT_ASSERT(dp.requested == 0);
|
||||||
|
TORRENT_ASSERT(dp.index == index);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_ses.m_alerts.should_post<piece_finished_alert>())
|
if (m_ses.m_alerts.should_post<piece_finished_alert>())
|
||||||
{
|
{
|
||||||
|
@ -5998,6 +6010,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(piece_index >= 0);
|
TORRENT_ASSERT(piece_index >= 0);
|
||||||
TORRENT_ASSERT(piece_index < m_torrent_file->num_pieces());
|
TORRENT_ASSERT(piece_index < m_torrent_file->num_pieces());
|
||||||
TORRENT_ASSERT(piece_index < (int)m_picker->num_pieces());
|
TORRENT_ASSERT(piece_index < (int)m_picker->num_pieces());
|
||||||
|
TORRENT_ASSERT(!m_picker || !m_picker->have_piece(piece_index));
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
if (m_picker)
|
if (m_picker)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue