fixed race condition when calling a function that re-evaluates the interested flags on peers (such as prioritize files) right after the metadata is received, but before the connections are initialized

This commit is contained in:
Arvid Norberg 2008-09-18 20:17:49 +00:00
parent f14e76a3f9
commit e7df553fdd
1 changed files with 5 additions and 0 deletions

View File

@ -337,6 +337,11 @@ namespace libtorrent
boost::shared_ptr<torrent> t = m_torrent.lock();
TORRENT_ASSERT(t);
// if m_have_piece is 0, it means the connections
// have not been initialized yet. The interested
// flag will be updated once they are.
if (m_have_piece.size() == 0) return;
bool interested = false;
if (!t->is_finished())
{