initialize connections immediately when metadata is received

This commit is contained in:
Arvid Norberg 2012-04-26 16:38:36 +00:00
parent 66ed31dd4b
commit 6b40d5983b
1 changed files with 17 additions and 0 deletions

View File

@ -1547,6 +1547,23 @@ namespace libtorrent
std::fill(m_file_priority.begin(), m_file_priority.end(), 0);
}
if (!m_connections_initialized)
{
m_connections_initialized = true;
// all peer connections have to initialize themselves now that the metadata
// is available
for (torrent::peer_iterator i = m_connections.begin();
i != m_connections.end();)
{
peer_connection* pc = *i;
++i;
if (pc->is_disconnecting()) continue;
pc->on_metadata_impl();
if (pc->is_disconnecting()) continue;
pc->init();
}
}
// in case file priorities were passed in via the add_torrent_params
// ans also in the case of share mode, we need to update the priorities
update_piece_priorities();