From 6b40d5983b09a0236690d55fc73654daf73230e7 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 26 Apr 2012 16:38:36 +0000 Subject: [PATCH] initialize connections immediately when metadata is received --- src/torrent.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index aa3bc8c3b..cf49b3278 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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();