From bcb359cef649deb3bdfaf7788adc83e9e023b31b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 6 May 2016 08:08:49 -0400 Subject: [PATCH 1/6] use unsigned long for ioctl commands (#705) --- src/enum_net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enum_net.cpp b/src/enum_net.cpp index 9b0abab46..16ced9399 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -90,7 +90,7 @@ POSSIBILITY OF SUCH DAMAGE. #if TORRENT_USE_IFADDRS || TORRENT_USE_IFCONF || TORRENT_USE_NETLINK || TORRENT_USE_SYSCTL // capture this here where warnings are disabled (the macro generates warnings) -const int siocgifmtu = SIOCGIFMTU; +const unsigned long siocgifmtu = SIOCGIFMTU; #endif #include "libtorrent/aux_/disable_warnings_pop.hpp" From 6d49d9d0618e7308d0705329c02989c8a079c652 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 6 May 2016 17:41:38 -0400 Subject: [PATCH 2/6] update libsimulator submodule --- simulation/libsimulator | 2 +- simulation/setup_swarm.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index ad23c932e..ea3bffe3c 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit ad23c932ecd852f89c7d8b29dfe162e9ee073a1b +Subproject commit ea3bffe3c53bca5e0976914ea951193ba43fbed6 diff --git a/simulation/setup_swarm.cpp b/simulation/setup_swarm.cpp index 7eca2fbd0..e30a5337d 100644 --- a/simulation/setup_swarm.cpp +++ b/simulation/setup_swarm.cpp @@ -47,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "setup_swarm.hpp" #include "setup_transfer.hpp" // for create_torrent #include "utils.hpp" +#include "simulator/queue.hpp" namespace lt = libtorrent; using namespace sim; From 254906eddc934c50292cfd2c93d60cc546bb91a2 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 7 May 2016 14:56:22 -0400 Subject: [PATCH 3/6] back-port torrent peer-class fix from master --- ChangeLog | 1 + simulation/libsimulator | 2 +- src/torrent.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eeaa76991..b9370be6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 1.1.1 release + * fixed peer-class leak when settings per-torrent rate limits * added a new "preformatted" type to bencode entry variant type * improved Socks5 support and test coverage * fix set_settings in python binding diff --git a/simulation/libsimulator b/simulation/libsimulator index ea3bffe3c..ad23c932e 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit ea3bffe3c53bca5e0976914ea951193ba43fbed6 +Subproject commit ad23c932ecd852f89c7d8b29dfe162e9ee073a1b diff --git a/src/torrent.cpp b/src/torrent.cpp index 359b58368..911b0a828 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -970,6 +970,7 @@ namespace libtorrent // this means that the invariant check that this is called from the // network thread cannot be maintained + TORRENT_ASSERT(m_peer_class == 0); TORRENT_ASSERT(m_abort); TORRENT_ASSERT(m_connections.empty()); if (!m_connections.empty()) @@ -4936,6 +4937,12 @@ namespace libtorrent update_gauge(); stop_announcing(); + if (m_peer_class > 0) + { + m_ses.peer_classes().decref(m_peer_class); + m_peer_class = 0; + } + error_code ec; m_inactivity_timer.cancel(ec); From 5cd022cadb219f7654758641c645a8afe6f8ab7c Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 7 May 2016 21:43:06 -0400 Subject: [PATCH 4/6] fix submodule --- simulation/libsimulator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index ad23c932e..ea3bffe3c 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit ad23c932ecd852f89c7d8b29dfe162e9ee073a1b +Subproject commit ea3bffe3c53bca5e0976914ea951193ba43fbed6 From debd02ff02b4d63c4e116132f0b5c633bdf6d260 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 8 May 2016 20:41:55 -0400 Subject: [PATCH 5/6] =?UTF-8?q?improve=20reference=20documentation=20gener?= =?UTF-8?q?ator=20to=20correctly=20recognize=20memb=E2=80=A6=20(#716)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit improve reference documentation generator to correctly recognize member constants defined over multiple lines --- docs/gen_reference_doc.py | 54 +++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index de3a40d20..0bc999306 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -186,16 +186,44 @@ def html_sanitize(s): else: ret += i return ret -def looks_like_variable(line): +def looks_like_namespace(line): + line = line.strip() + if line.startswith('namespace'): return True + return False + +def looks_like_blank(line): + line = line.split('//')[0] + line = line.replace('{', '') + line = line.replace('}', '') + line = line.replace('[', '') + line = line.replace(']', '') + line = line.replace(';', '') + line = line.strip() + return len(line) == 0 + +def looks_like_variable(line): + line = line.split('//')[0] line = line.strip() - if not line.endswith(';'): return False if not ' ' in line and not '\t' in line: return False if line.startswith('friend '): return False if line.startswith('enum '): return False if line.startswith(','): return False if line.startswith(':'): return False if line.startswith('typedef'): return False - return True + if ' = ' in line: return True + if line.endswith(';'): return True + return False + +def looks_like_forward_decl(line): + line = line.split('//')[0] + line = line.strip() + if not line.endswith(';'): return False + if '{' in line: return False + if '}' in line: return False + if line.startswith('friend '): return True + if line.startswith('struct '): return True + if line.startswith('class '): return True + return False def looks_like_function(line): if line.startswith('friend'): return False @@ -348,8 +376,10 @@ def parse_class(lno, lines, filename): continue if looks_like_variable(l): + if verbose: print 'var %s' % l if not is_visible(context): continue + l = l.split('//')[0].strip() n = l.split(' ')[-1].split(':')[0].split(';')[0] if context == '' and blanks == 0 and len(fields): fields[-1]['names'].append(n) @@ -364,6 +394,7 @@ def parse_class(lno, lines, filename): continue if l.startswith('enum '): + if verbose: print 'enum %s' % l if not is_visible(context): consume_block(lno - 1, lines) else: @@ -378,7 +409,14 @@ def parse_class(lno, lines, filename): continue context = '' - if verbose: print '?? %s' % l + + if verbose: + if looks_like_forward_decl(l) \ + or looks_like_blank(l) \ + or looks_like_namespace(l): + print '-- %s' % l + else: + print '?? %s' % l if len(name) > 0: print '\x1b[31mFAILED TO PARSE CLASS\x1b[0m %s\nfile: %s:%d' % (name, filename, lno) @@ -660,7 +698,13 @@ for filename in files: continue blanks += 1 - if verbose: print '?? %s' % l + if verbose: + if looks_like_forward_decl(l) \ + or looks_like_blank(l) \ + or looks_like_namespace(l): + print '-- %s' % l + else: + print '?? %s' % l context = '' h.close() From 5bedf3e7b3204e34c6fb321e5b6b28d82fc1f2b2 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 8 May 2016 23:48:27 -0400 Subject: [PATCH 6/6] post add_torrent_alert before any other torrent alert (#717) post add_torrent_alert before any other torrent alert --- ChangeLog | 2 + include/libtorrent/aux_/session_impl.hpp | 2 +- simulation/test_torrent_status.cpp | 43 +++ src/session_impl.cpp | 369 ++++++++++++----------- 4 files changed, 234 insertions(+), 182 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9370be6c..90596a4b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 1.1.1 release + * make sure add_torrent_alert is always posted before other alerts for + the torrent * fixed peer-class leak when settings per-torrent rate limits * added a new "preformatted" type to bencode entry variant type * improved Socks5 support and test coverage diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 49ff38d3e..fe00f8e9a 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -406,7 +406,7 @@ namespace libtorrent #endif torrent_handle add_torrent(add_torrent_params const&, error_code& ec); - torrent_handle add_torrent_impl(add_torrent_params const&, error_code& ec); + boost::shared_ptr add_torrent_impl(add_torrent_params& p, error_code& ec); void async_add_torrent(add_torrent_params* params); void on_async_load_torrent(disk_io_job const* j); diff --git a/simulation/test_torrent_status.cpp b/simulation/test_torrent_status.cpp index 2addf6905..7b6959015 100644 --- a/simulation/test_torrent_status.cpp +++ b/simulation/test_torrent_status.cpp @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "setup_swarm.hpp" #include "simulator/simulator.hpp" #include "libtorrent/alert_types.hpp" +#include "libtorrent/settings_pack.hpp" using namespace libtorrent; using namespace sim; @@ -98,3 +99,45 @@ TORRENT_TEST(status_timers) }); } +// This test makes sure that adding a torrent causes no torrent related alert to +// be posted _before_ the add_torrent_alert, which is expected to always be the +// first +TORRENT_TEST(alert_order) +{ + bool received_add_torrent_alert = false; + int num_torrent_alerts = 0; + + lt::torrent_handle handle; + + setup_swarm(1, swarm_test::upload + // add session + , [](lt::settings_pack& sett) { + sett.set_int(settings_pack::alert_mask, alert::all_categories); + } + // add torrent + , [](lt::add_torrent_params& params) {} + // on alert + , [&](lt::alert const* a, lt::session& ses) { + if (auto ta = alert_cast(a)) + { + TEST_EQUAL(received_add_torrent_alert, false); + received_add_torrent_alert = true; + handle = ta->handle; + } + + if (auto ta = dynamic_cast(a)) + { + TEST_EQUAL(received_add_torrent_alert, true); + TEST_CHECK(handle == ta->handle); + ++num_torrent_alerts; + } + } + // terminate + , [&](int ticks, lt::session& ses) -> bool + { return ticks > 10; } + ); + + TEST_EQUAL(received_add_torrent_alert, true); + TEST_CHECK(num_torrent_alerts > 1); +} + diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 6efe287c7..6bfa31b1f 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4777,188 +4777,20 @@ retry: torrent_handle session_impl::add_torrent(add_torrent_params const& p , error_code& ec) { - torrent_handle h = add_torrent_impl(p, ec); - m_alerts.emplace_alert(h, p, ec); - return h; - } - - torrent_handle session_impl::add_torrent_impl(add_torrent_params const& p - , error_code& ec) - { - TORRENT_ASSERT(!p.save_path.empty()); - -#ifndef TORRENT_NO_DEPRECATE - p.update_flags(); -#endif - + // params is updated by add_torrent_impl() add_torrent_params params = p; - if (string_begins_no_case("magnet:", params.url.c_str())) - { - parse_magnet_uri(params.url, params, ec); - if (ec) return torrent_handle(); - params.url.clear(); - } + boost::shared_ptr const torrent_ptr = add_torrent_impl(params, ec); - if (string_begins_no_case("file://", params.url.c_str()) && !params.ti) - { - std::string filename = resolve_file_url(params.url); - boost::shared_ptr t = boost::make_shared(filename, boost::ref(ec), 0); - if (ec) return torrent_handle(); - params.url.clear(); - params.ti = t; - } + torrent_handle const handle(torrent_ptr); + m_alerts.emplace_alert(handle, params, ec); - if (params.ti && params.ti->is_valid() && params.ti->num_files() == 0) - { - ec = errors::no_files_in_torrent; - return torrent_handle(); - } + if (!torrent_ptr) return handle; -#ifndef TORRENT_DISABLE_DHT - // add p.dht_nodes to the DHT, if enabled - if (!p.dht_nodes.empty()) - { - for (std::vector >::const_iterator i = p.dht_nodes.begin() - , end(p.dht_nodes.end()); i != end; ++i) - { - add_dht_node_name(*i); - } - } -#endif - - INVARIANT_CHECK; - - if (is_aborted()) - { - ec = errors::session_is_closing; - return torrent_handle(); - } - - // figure out the info hash of the torrent - sha1_hash const* ih = 0; - sha1_hash tmp; - if (params.ti) ih = ¶ms.ti->info_hash(); - else if (!params.url.empty()) - { - // in order to avoid info-hash collisions, for - // torrents where we don't have an info-hash, but - // just a URL, set the temporary info-hash to the - // hash of the URL. This will be changed once we - // have the actual .torrent file - tmp = hasher(¶ms.url[0], params.url.size()).final(); - ih = &tmp; - } - else ih = ¶ms.info_hash; - - // we don't have a torrent file. If the user provided - // resume data, there may be some metadata in there - // TODO: this logic could probably be less spaghetti looking by being - // moved to a function with early exits - if ((!params.ti || !params.ti->is_valid()) - && !params.resume_data.empty()) - { - int pos; - error_code err; - bdecode_node root; - bdecode_node info; -#ifndef TORRENT_DISABLE_LOGGING - session_log("adding magnet link with resume data"); -#endif - if (bdecode(¶ms.resume_data[0], ¶ms.resume_data[0] - + params.resume_data.size(), root, err, &pos) == 0 - && root.type() == bdecode_node::dict_t - && (info = root.dict_find_dict("info"))) - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("found metadata in resume data"); -#endif - // verify the info-hash of the metadata stored in the resume file matches - // the torrent we're loading - - std::pair buf = info.data_section(); - sha1_hash resume_ih = hasher(buf.first, buf.second).final(); - - // if url is set, the info_hash is not actually the info-hash of the - // torrent, but the hash of the URL, until we have the full torrent - // only require the info-hash to match if we actually passed in one - if (resume_ih == params.info_hash - || !params.url.empty() - || params.info_hash.is_all_zeros()) - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("info-hash matched"); -#endif - params.ti = boost::make_shared(resume_ih); - - if (params.ti->parse_info_section(info, err, 0)) - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("successfully loaded metadata from resume file"); -#endif - // make the info-hash be the one in the resume file - params.info_hash = resume_ih; - ih = ¶ms.info_hash; - } - else - { -#ifndef TORRENT_DISABLE_LOGGING - session_log("failed to load metadata from resume file: %s" - , err.message().c_str()); -#endif - } - } -#ifndef TORRENT_DISABLE_LOGGING - else - { - session_log("metadata info-hash failed"); - } -#endif - } -#ifndef TORRENT_DISABLE_LOGGING - else - { - session_log("no metadata found (\"%s\")", err.message().c_str()); - } -#endif - } - - // is the torrent already active? - boost::shared_ptr torrent_ptr = find_torrent(*ih).lock(); - if (!torrent_ptr && !params.uuid.empty()) torrent_ptr = find_torrent(params.uuid).lock(); - // if we still can't find the torrent, look for it by url - if (!torrent_ptr && !params.url.empty()) - { - torrent_map::iterator i = std::find_if(m_torrents.begin() - , m_torrents.end(), boost::bind(&torrent::url, boost::bind(&std::pair >::second, _1)) == params.url); - if (i != m_torrents.end()) - torrent_ptr = i->second; - } - - if (torrent_ptr) - { - if ((params.flags & add_torrent_params::flag_duplicate_is_error) == 0) - { - if (!params.uuid.empty() && torrent_ptr->uuid().empty()) - torrent_ptr->set_uuid(params.uuid); - if (!params.url.empty() && torrent_ptr->url().empty()) - torrent_ptr->set_url(params.url); - if (!params.source_feed_url.empty() && torrent_ptr->source_feed_url().empty()) - torrent_ptr->set_source_feed_url(params.source_feed_url); - return torrent_handle(torrent_ptr); - } - - ec = errors::duplicate_torrent; - return torrent_handle(); - } - - int queue_pos = ++m_max_queue_pos; - - torrent_ptr = boost::make_shared(boost::ref(*this) - , 16 * 1024, queue_pos, boost::cref(params), boost::cref(*ih)); + // params.info_hash should have been initialized by add_torrent_impl() + TORRENT_ASSERT(params.info_hash != sha1_hash(0)); if (m_alerts.should_post()) - m_alerts.emplace_alert(torrent_ptr->get_handle()); + m_alerts.emplace_alert(handle); torrent_ptr->set_ip_filter(m_ip_filter); torrent_ptr->start(params); @@ -4971,8 +4803,7 @@ retry: for (torrent_plugins_t::const_iterator i = params.extensions.begin() , end(params.extensions.end()); i != end; ++i) { - torrent_ptr->add_extension((*i)(torrent_ptr->get_handle(), - params.userdata)); + torrent_ptr->add_extension((*i)(handle, params.userdata)); } add_extensions_to_torrent(torrent_ptr, params.userdata); @@ -5002,14 +4833,14 @@ retry: float load_factor = m_torrents.load_factor(); #endif // TORRENT_HAS_BOOST_UNORDERED - m_torrents.insert(std::make_pair(*ih, torrent_ptr)); + m_torrents.insert(std::make_pair(params.info_hash, torrent_ptr)); TORRENT_ASSERT(m_torrents.size() >= m_torrent_lru.size()); #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) hasher h; h.update("req2", 4); - h.update(ih->data(), 20); + h.update(params.info_hash.data(), 20); // this is SHA1("req2" + info-hash), used for // encrypted hand shakes m_obfuscated_torrents.insert(std::make_pair(h.final(), torrent_ptr)); @@ -5067,7 +4898,183 @@ retry: } } - return torrent_handle(torrent_ptr); + return handle; + } + + boost::shared_ptr session_impl::add_torrent_impl( + add_torrent_params& params + , error_code& ec) + { + TORRENT_ASSERT(!params.save_path.empty()); + + typedef boost::shared_ptr ptr_t; + +#ifndef TORRENT_NO_DEPRECATE + params.update_flags(); +#endif + + if (string_begins_no_case("magnet:", params.url.c_str())) + { + parse_magnet_uri(params.url, params, ec); + if (ec) return ptr_t(); + params.url.clear(); + } + + if (string_begins_no_case("file://", params.url.c_str()) && !params.ti) + { + std::string filename = resolve_file_url(params.url); + boost::shared_ptr t = boost::make_shared(filename, boost::ref(ec), 0); + if (ec) return ptr_t(); + params.url.clear(); + params.ti = t; + } + + if (params.ti && params.ti->is_valid() && params.ti->num_files() == 0) + { + ec = errors::no_files_in_torrent; + return ptr_t(); + } + +#ifndef TORRENT_DISABLE_DHT + // add params.dht_nodes to the DHT, if enabled + if (!params.dht_nodes.empty()) + { + for (std::vector >::const_iterator i = params.dht_nodes.begin() + , end(params.dht_nodes.end()); i != end; ++i) + { + add_dht_node_name(*i); + } + } +#endif + + INVARIANT_CHECK; + + if (is_aborted()) + { + ec = errors::session_is_closing; + return ptr_t(); + } + + // figure out the info hash of the torrent and make sure params.info_hash + // is set correctly + if (params.ti) params.info_hash = params.ti->info_hash(); + else if (!params.url.empty()) + { + // in order to avoid info-hash collisions, for + // torrents where we don't have an info-hash, but + // just a URL, set the temporary info-hash to the + // hash of the URL. This will be changed once we + // have the actual .torrent file + params.info_hash = hasher(¶ms.url[0], params.url.size()).final(); + } + + // we don't have a torrent file. If the user provided + // resume data, there may be some metadata in there + // TODO: this logic could probably be less spaghetti looking by being + // moved to a function with early exits + if ((!params.ti || !params.ti->is_valid()) + && !params.resume_data.empty()) + { + int pos; + error_code err; + bdecode_node root; + bdecode_node info; +#ifndef TORRENT_DISABLE_LOGGING + session_log("adding magnet link with resume data"); +#endif + if (bdecode(¶ms.resume_data[0], ¶ms.resume_data[0] + + params.resume_data.size(), root, err, &pos) == 0 + && root.type() == bdecode_node::dict_t + && (info = root.dict_find_dict("info"))) + { +#ifndef TORRENT_DISABLE_LOGGING + session_log("found metadata in resume data"); +#endif + // verify the info-hash of the metadata stored in the resume file matches + // the torrent we're loading + + std::pair const buf = info.data_section(); + sha1_hash const resume_ih = hasher(buf.first, buf.second).final(); + + // if url is set, the info_hash is not actually the info-hash of the + // torrent, but the hash of the URL, until we have the full torrent + // only require the info-hash to match if we actually passed in one + if (resume_ih == params.info_hash + || !params.url.empty() + || params.info_hash.is_all_zeros()) + { +#ifndef TORRENT_DISABLE_LOGGING + session_log("info-hash matched"); +#endif + params.ti = boost::make_shared(resume_ih); + + if (params.ti->parse_info_section(info, err, 0)) + { +#ifndef TORRENT_DISABLE_LOGGING + session_log("successfully loaded metadata from resume file"); +#endif + // make the info-hash be the one in the resume file + params.info_hash = resume_ih; + } + else + { +#ifndef TORRENT_DISABLE_LOGGING + session_log("failed to load metadata from resume file: %s" + , err.message().c_str()); +#endif + } + } +#ifndef TORRENT_DISABLE_LOGGING + else + { + session_log("metadata info-hash failed"); + } +#endif + } +#ifndef TORRENT_DISABLE_LOGGING + else + { + session_log("no metadata found (\"%s\")", err.message().c_str()); + } +#endif + } + + // is the torrent already active? + boost::shared_ptr torrent_ptr = find_torrent(params.info_hash).lock(); + if (!torrent_ptr && !params.uuid.empty()) torrent_ptr = find_torrent(params.uuid).lock(); + // if we still can't find the torrent, look for it by url + if (!torrent_ptr && !params.url.empty()) + { + torrent_map::iterator i = std::find_if(m_torrents.begin() + , m_torrents.end(), boost::bind(&torrent::url, boost::bind(&std::pair >::second, _1)) == params.url); + if (i != m_torrents.end()) + torrent_ptr = i->second; + } + + if (torrent_ptr) + { + if ((params.flags & add_torrent_params::flag_duplicate_is_error) == 0) + { + if (!params.uuid.empty() && torrent_ptr->uuid().empty()) + torrent_ptr->set_uuid(params.uuid); + if (!params.url.empty() && torrent_ptr->url().empty()) + torrent_ptr->set_url(params.url); + if (!params.source_feed_url.empty() && torrent_ptr->source_feed_url().empty()) + torrent_ptr->set_source_feed_url(params.source_feed_url); + return torrent_ptr; + } + + ec = errors::duplicate_torrent; + return ptr_t(); + } + + int queue_pos = ++m_max_queue_pos; + + torrent_ptr = boost::make_shared(boost::ref(*this) + , 16 * 1024, queue_pos, boost::cref(params), boost::cref(params.info_hash)); + + return torrent_ptr; } void session_impl::update_outgoing_interfaces()