assert that offset didn't change while hashing

This commit is contained in:
Steven Siloti 2016-10-24 22:02:44 -07:00 committed by Arvid Norberg
parent f36b9a805a
commit cf7db392b6
1 changed files with 8 additions and 0 deletions

View File

@ -2155,6 +2155,9 @@ namespace libtorrent
// save a local copy of offset to avoid concurrent access
int offset = ph->offset;
#if TORRENT_USE_ASSERTS
int old_offset = offset;
#endif
l.unlock();
@ -2172,6 +2175,7 @@ namespace libtorrent
l.lock();
TORRENT_ASSERT(old_offset == ph->offset);
ph->offset = offset;
TORRENT_PIECE_ASSERT(pe->hashing, pe);
@ -2395,6 +2399,9 @@ namespace libtorrent
// save a local copy of offset to avoid concurrent access
int offset = ph->offset;
#if TORRENT_USE_ASSERTS
int old_offset = offset;
#endif
l.unlock();
@ -2494,6 +2501,7 @@ namespace libtorrent
l.lock();
TORRENT_ASSERT(old_offset == ph->offset);
ph->offset = offset;
// decrement the refcounts of the blocks we just hashed