forked from premiere/premiere-libtorrent
add assert to storage
This commit is contained in:
parent
2647ca2412
commit
51003d11ca
|
@ -1102,6 +1102,18 @@ namespace libtorrent
|
|||
|
||||
boost::shared_ptr<piece_manager> storage = j->storage;
|
||||
|
||||
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
if (storage)
|
||||
{
|
||||
mutex::scoped_lock l(m_cache_mutex);
|
||||
boost::unordered_set<cached_piece_entry*> const& pieces = storage->cached_pieces();
|
||||
for (boost::unordered_set<cached_piece_entry*>::const_iterator i = pieces.begin()
|
||||
, end(pieces.end()); i != end; ++i)
|
||||
{
|
||||
TORRENT_ASSERT((*i)->storage == storage);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// TODO: instead of doing this. pass in the settings to each storage_interface
|
||||
// call. Each disk thread could hold its most recent understanding of the settings
|
||||
// in a shared_ptr, and update it every time it wakes up from a job. That way
|
||||
|
@ -1796,6 +1808,17 @@ namespace libtorrent
|
|||
j->storage = storage->shared_from_this();
|
||||
j->callback = handler;
|
||||
|
||||
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||
{
|
||||
mutex::scoped_lock l(m_cache_mutex);
|
||||
boost::unordered_set<cached_piece_entry*> const& pieces = storage->cached_pieces();
|
||||
for (boost::unordered_set<cached_piece_entry*>::const_iterator i = pieces.begin()
|
||||
, end(pieces.end()); i != end; ++i)
|
||||
{
|
||||
TORRENT_ASSERT((*i)->storage.get() == storage);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
add_fence_job(storage, j);
|
||||
}
|
||||
|
||||
|
|
|
@ -1765,6 +1765,7 @@ namespace libtorrent
|
|||
|
||||
void storage_piece_set::remove_piece(cached_piece_entry* p)
|
||||
{
|
||||
TORRENT_ASSERT(p->storage.get() == this);
|
||||
TORRENT_ASSERT(p->in_storage == true);
|
||||
TORRENT_ASSERT(m_cached_pieces.count(p) == 1);
|
||||
m_cached_pieces.erase(p);
|
||||
|
|
|
@ -129,7 +129,7 @@ void test_remove_torrent(int const remove_options
|
|||
|| st2.state == torrent_status::checking_resume_data);
|
||||
|
||||
// if nothing is being transferred after 3 seconds, we're failing the test
|
||||
if (st1.upload_payload_rate == 0 && i > 30)
|
||||
if (st1.total_payload_upload == 0 && i > 30)
|
||||
{
|
||||
TEST_ERROR("no transfer");
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue