diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 62712d5f6..e2f8d52d1 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1616,7 +1616,7 @@ namespace libtorrent #ifndef NDEBUG check_postcondition post_checker_(t); -#if !defined TORRENT_DISABLE_INVARIANT_CHECKS +#if !defined TORRENT_DISABLE_INVARIANT_CHECKS && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS t->check_invariant(); #endif #endif @@ -1791,7 +1791,8 @@ namespace libtorrent TORRENT_ASSERT(picker.num_peers(block_finished) == 0); -#if !defined NDEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS +#if !defined NDEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS \ + && defined TORRENT_EXPENSIVE_INVARIANT_CHECKS t->check_invariant(); #endif request_a_block(*t, *this); diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index c8b5d8d99..8935609fa 100644 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -122,7 +122,9 @@ namespace libtorrent void piece_picker::piece_info(int index, piece_picker::downloading_piece& st) const { +#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS TORRENT_PIECE_PICKER_INVARIANT_CHECK; +#endif TORRENT_ASSERT(index >= 0); TORRENT_ASSERT(index < int(m_piece_map.size())); @@ -1312,7 +1314,9 @@ namespace libtorrent // only one of rarest_first and sequential can be set. TORRENT_ASSERT(bool(options & rarest_first) + bool(options & sequential) <= 1); +#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS TORRENT_PIECE_PICKER_INVARIANT_CHECK; +#endif TORRENT_ASSERT(num_blocks > 0); TORRENT_ASSERT(pieces.size() == m_piece_map.size());