From 9e0a3aead1356a963f758ee95a4671d32f4617a7 Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Wed, 13 Dec 2017 16:01:08 -0800 Subject: [PATCH] use info hash from params instead of passing it separately --- include/libtorrent/torrent.hpp | 3 +-- src/session_impl.cpp | 2 +- src/torrent.cpp | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 7edebf6d7..e679eff29 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -330,8 +330,7 @@ namespace libtorrent { public: torrent(aux::session_interface& ses, int block_size - , bool session_paused, add_torrent_params const& p - , sha1_hash const& info_hash); + , bool session_paused, add_torrent_params const& p); ~torrent() override; // This may be called from multiple threads diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 56c4dc310..5acc08e31 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4954,7 +4954,7 @@ namespace { torrent_ptr = std::make_shared(*this , 16 * 1024, m_paused - , params, params.info_hash); + , params); torrent_ptr->set_queue_position(m_download_queue.end_index()); return std::make_pair(torrent_ptr, true); diff --git a/src/torrent.cpp b/src/torrent.cpp index 5b43b807f..64684292d 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -163,8 +163,7 @@ namespace libtorrent { aux::session_interface& ses , int const block_size , bool const session_paused - , add_torrent_params const& p - , sha1_hash const& info_hash) + , add_torrent_params const& p) : torrent_hot_members(ses, p, block_size, session_paused) , m_tracker_timer(ses.get_io_service()) , m_inactivity_timer(ses.get_io_service()) @@ -179,7 +178,7 @@ namespace libtorrent { , m_storage_constructor(p.storage) , m_added_time(p.added_time ? p.added_time : std::time(nullptr)) , m_completed_time(p.completed_time) - , m_info_hash(info_hash) + , m_info_hash(p.info_hash) , m_error_file(torrent_status::error_file_none) , m_sequence_number(-1) , m_announce_to_trackers(!(p.flags & torrent_flags::paused)) @@ -244,7 +243,7 @@ namespace libtorrent { } if (!m_torrent_file) - m_torrent_file = (p.ti ? p.ti : std::make_shared(info_hash)); + m_torrent_file = (p.ti ? p.ti : std::make_shared(m_info_hash)); // --- WEB SEEDS ---