forked from premiere/premiere-libtorrent
some asserts in disk_io_thread. fix issue in torrent::initialize
This commit is contained in:
parent
6e0e64e2ff
commit
c8e8eb6e15
|
@ -332,6 +332,9 @@ void block_cache::cache_hit(cached_piece_entry* p, void* requester, bool volatil
|
||||||
// this can be pretty expensive
|
// this can be pretty expensive
|
||||||
// INVARIANT_CHECK;
|
// INVARIANT_CHECK;
|
||||||
|
|
||||||
|
TORRENT_ASSERT(p);
|
||||||
|
TORRENT_ASSERT(p->in_use);
|
||||||
|
|
||||||
// move the piece into this queue. Whenever we have a cahe
|
// move the piece into this queue. Whenever we have a cahe
|
||||||
// hit, we move the piece into the lru2 queue (i.e. the most
|
// hit, we move the piece into the lru2 queue (i.e. the most
|
||||||
// frequently used piece). However, we only do that if the
|
// frequently used piece). However, we only do that if the
|
||||||
|
|
|
@ -2307,6 +2307,7 @@ namespace libtorrent
|
||||||
cached_piece_entry* pe = m_disk_cache.find_piece(j);
|
cached_piece_entry* pe = m_disk_cache.find_piece(j);
|
||||||
if (pe)
|
if (pe)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(pe->in_use);
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
pe->piece_log.push_back(piece_log_t(j->action));
|
pe->piece_log.push_back(piece_log_t(j->action));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1741,11 +1741,13 @@ namespace libtorrent
|
||||||
m_connections_initialized = true;
|
m_connections_initialized = true;
|
||||||
// all peer connections have to initialize themselves now that the metadata
|
// all peer connections have to initialize themselves now that the metadata
|
||||||
// is available
|
// is available
|
||||||
for (torrent::peer_iterator i = m_connections.begin();
|
// copy the peer list since peers may disconnect and invalidate
|
||||||
i != m_connections.end();)
|
// m_connections as we initialize them
|
||||||
|
std::vector<peer_connection*> peers = m_connections;
|
||||||
|
for (torrent::peer_iterator i = peers.begin();
|
||||||
|
i != peers.end(); ++i)
|
||||||
{
|
{
|
||||||
peer_connection* pc = *i;
|
peer_connection* pc = *i;
|
||||||
++i;
|
|
||||||
if (pc->is_disconnecting()) continue;
|
if (pc->is_disconnecting()) continue;
|
||||||
pc->on_metadata_impl();
|
pc->on_metadata_impl();
|
||||||
if (pc->is_disconnecting()) continue;
|
if (pc->is_disconnecting()) continue;
|
||||||
|
|
Loading…
Reference in New Issue