From cc8066bf11be5057a8a0aaf19cbae954cd023410 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 20 Feb 2016 15:49:49 -0500 Subject: [PATCH] properly deprecated adding torrents by http url --- bindings/python/src/alert.cpp | 4 + bindings/python/src/magnet_uri.cpp | 4 +- bindings/python/src/session.cpp | 2 + include/libtorrent/add_torrent_params.hpp | 28 ++- include/libtorrent/alert_types.hpp | 2 +- include/libtorrent/aux_/session_impl.hpp | 9 + include/libtorrent/aux_/session_interface.hpp | 3 + include/libtorrent/torrent.hpp | 13 +- src/alert.cpp | 2 +- src/read_resume_data.cpp | 3 + src/session_impl.cpp | 27 +++ src/torrent.cpp | 194 ++++-------------- 12 files changed, 117 insertions(+), 174 deletions(-) diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 1d15c5569..895a895da 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -101,8 +101,10 @@ dict get_params(add_torrent_alert const& alert) ret["flags"] = p.flags; ret["trackerid"] = p.trackerid; ret["url"] = p.url; +#ifndef TORRENT_NO_DEPRECATE ret["source_feed_url"] = p.source_feed_url; ret["uuid"] = p.uuid; +#endif return ret; } @@ -677,11 +679,13 @@ void bind_alert() .add_property("params", &get_params) ; +#ifndef TORRENT_NO_DEPRECATE class_, noncopyable>( "torrent_update_alert", no_init) .def_readonly("old_ih", &torrent_update_alert::old_ih) .def_readonly("new_ih", &torrent_update_alert::new_ih) ; +#endif class_, noncopyable>( "dht_outgoing_get_peers_alert", no_init) diff --git a/bindings/python/src/magnet_uri.cpp b/bindings/python/src/magnet_uri.cpp index 132e613d3..07b1b3ca4 100644 --- a/bindings/python/src/magnet_uri.cpp +++ b/bindings/python/src/magnet_uri.cpp @@ -25,7 +25,7 @@ namespace { allow_threading_guard guard; - p.url = uri; + p.url = uri; #ifndef BOOST_NO_EXCEPTIONS return s.add_torrent(p); @@ -63,8 +63,10 @@ namespace { ret["save_path"] = p.save_path; ret["storage_mode"] = p.storage_mode; ret["url"] = p.url; +#ifndef TORRENT_NO_DEPRECATE ret["uuid"] = p.uuid; ret["source_feed_url"] = p.source_feed_url; +#endif ret["flags"] = p.flags; return ret; } diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 36f278d95..799154ab4 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -228,10 +228,12 @@ namespace p.trackerid = extract(params["trackerid"]); if (params.has_key("url")) p.url = extract(params["url"]); +#ifndef TORRENT_NO_DEPRECATE if (params.has_key("source_feed_url")) p.source_feed_url = extract(params["source_feed_url"]); if (params.has_key("uuid")) p.uuid = extract(params["uuid"]); +#endif if (params.has_key("file_priorities")) { diff --git a/include/libtorrent/add_torrent_params.hpp b/include/libtorrent/add_torrent_params.hpp index 2c8fa6016..4b1d3021c 100644 --- a/include/libtorrent/add_torrent_params.hpp +++ b/include/libtorrent/add_torrent_params.hpp @@ -362,16 +362,6 @@ namespace libtorrent // will indicate what went wrong. The ``url`` may be set to a magnet link. std::string url; - // if ``uuid`` is specified, it is used to find duplicates. If another - // torrent is already running with the same UUID as the one being added, - // it will be considered a duplicate. This is mainly useful for RSS feed - // items which has UUIDs specified. - std::string uuid; - - // should point to the URL of the RSS feed this torrent comes from, if it - // comes from an RSS feed. - std::string source_feed_url; - // flags controlling aspects of this torrent and how it's added. See // flags_t for details. boost::uint64_t flags; @@ -485,6 +475,17 @@ namespace libtorrent std::map renamed_files; #ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 + // if ``uuid`` is specified, it is used to find duplicates. If another + // torrent is already running with the same UUID as the one being added, + // it will be considered a duplicate. This is mainly useful for RSS feed + // items which has UUIDs specified. + std::string uuid; + + // should point to the URL of the RSS feed this torrent comes from, if it + // comes from an RSS feed. + std::string source_feed_url; + // The optional parameter, ``resume_data`` can be given if up to date // fast-resume data is available. The fast-resume data can be acquired // from a running torrent by calling save_resume_data() on @@ -498,6 +499,13 @@ namespace libtorrent // communicated forward into libtorrent via this field. If this is set, a // fastresume_rejected_alert will be posted. error_code internal_resume_data_error; +#else + // hidden + // to maintain ABI compatibility + std::string deprecated1; + std::string deprecated2; + std::vector deprecated3; + error_code deprecated4; #endif }; diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 6c973f35f..cf90d6f88 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -1887,6 +1887,7 @@ namespace libtorrent boost::uint64_t values[counters::num_counters]; }; +#ifndef TORRENT_NO_DEPRECATE // hidden // When a torrent changes its info-hash, this alert is posted. This only // happens in very specific cases. For instance, when a torrent is @@ -1911,7 +1912,6 @@ namespace libtorrent sha1_hash new_ih; }; -#ifndef TORRENT_NO_DEPRECATE // This alert is posted every time a new RSS item (i.e. torrent) is received // from an RSS feed. // diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 263cbd9d4..7f71aae4d 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -266,7 +266,10 @@ namespace libtorrent #endif boost::weak_ptr find_torrent(sha1_hash const& info_hash) const TORRENT_OVERRIDE; +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 boost::weak_ptr find_torrent(std::string const& uuid) const; +#endif #ifndef TORRENT_DISABLE_MUTABLE_TORRENTS std::vector > find_collection( std::string const& collection) const TORRENT_OVERRIDE; @@ -276,8 +279,11 @@ namespace libtorrent void insert_torrent(sha1_hash const& ih, boost::shared_ptr const& t , std::string uuid) TORRENT_OVERRIDE; +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 void insert_uuid_torrent(std::string uuid, boost::shared_ptr const& t) TORRENT_OVERRIDE { m_uuids.insert(std::make_pair(uuid, t)); } +#endif boost::shared_ptr delay_load_torrent(sha1_hash const& info_hash , peer_connection* pc) TORRENT_OVERRIDE; void set_queue_position(torrent* t, int p) TORRENT_OVERRIDE; @@ -794,7 +800,10 @@ namespace libtorrent // list. linked_list m_torrent_lru; +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 std::map > m_uuids; +#endif // peer connections are put here when disconnected to avoid // race conditions with the disk thread. It's important that diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 0d746656c..af218cf37 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -190,7 +190,10 @@ namespace libtorrent { namespace aux , peer_connection* pc) = 0; virtual void insert_torrent(sha1_hash const& ih, boost::shared_ptr const& t , std::string uuid) = 0; +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 virtual void insert_uuid_torrent(std::string uuid, boost::shared_ptr const& t) = 0; +#endif virtual void set_queue_position(torrent* t, int p) = 0; virtual int num_torrents() const = 0; diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 7703fc309..2f110db8e 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -963,12 +963,15 @@ namespace libtorrent boost::shared_ptr get_torrent_copy(); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 std::string const& uuid() const { return m_uuid; } void set_uuid(std::string const& s) { m_uuid = s; } std::string const& url() const { return m_url; } void set_url(std::string const& s) { m_url = s; } std::string const& source_feed_url() const { return m_source_feed_url; } void set_source_feed_url(std::string const& s) { m_source_feed_url = s; } +#endif std::vector const& trackers() const { return m_trackers; } @@ -1030,8 +1033,10 @@ namespace libtorrent // a return value of false indicates an error bool set_metadata(char const* metadata_buf, int metadata_size); +#ifndef TORRENT_NO_DEPRECATE void on_torrent_download(error_code const& ec, http_parser const& parser , char const* data, int size); +#endif int sequence_number() const { return m_sequence_number; } @@ -1256,6 +1261,9 @@ namespace libtorrent std::string m_save_path; +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 + // if we don't have the metadata, this is a url to // the torrent file std::string m_url; @@ -1267,10 +1275,7 @@ namespace libtorrent // if this torrent was added by an RSS feed, this is the // URL to that feed std::string m_source_feed_url; - - // this is used as temporary storage while downloading - // the .torrent file from m_url -// std::vector m_torrent_file_buf; +#endif // this is a list of all pieces that we have announced // as having, without actually having yet. If we receive diff --git a/src/alert.cpp b/src/alert.cpp index e11827866..1b3ce18bb 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -1355,6 +1355,7 @@ namespace libtorrent { return names[op]; } +#ifndef TORRENT_NO_DEPRECATE torrent_update_alert::torrent_update_alert(aux::stack_allocator& alloc, torrent_handle h , sha1_hash const& old_hash, sha1_hash const& new_hash) : torrent_alert(alloc, h) @@ -1371,7 +1372,6 @@ namespace libtorrent { return torrent_alert::message() + msg; } -#ifndef TORRENT_NO_DEPRECATE rss_item_alert::rss_item_alert(aux::stack_allocator&, feed_handle h , feed_item const& i) : handle(h) diff --git a/src/read_resume_data.cpp b/src/read_resume_data.cpp index c91e35f0a..930155f75 100644 --- a/src/read_resume_data.cpp +++ b/src/read_resume_data.cpp @@ -145,8 +145,11 @@ namespace libtorrent ret.save_path = rd.dict_find_string_value("save_path"); ret.url = rd.dict_find_string_value("url"); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 ret.uuid = rd.dict_find_string_value("uuid"); ret.source_feed_url = rd.dict_find_string_value("feed"); +#endif bdecode_node mapped_files = rd.dict_find_list("mapped_files"); if (mapped_files) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 965fc4adf..a28b274b7 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -4243,7 +4243,12 @@ namespace aux { , std::string uuid) { m_torrents.insert(std::make_pair(ih, t)); +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 if (!uuid.empty()) m_uuids.insert(std::make_pair(uuid, t)); +#else + TORRENT_UNUSED(uuid); +#endif TORRENT_ASSERT(m_torrents.size() >= m_torrent_lru.size()); } @@ -4340,6 +4345,8 @@ namespace aux { } #endif +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 boost::weak_ptr session_impl::find_torrent(std::string const& uuid) const { TORRENT_ASSERT(is_single_thread()); @@ -4349,6 +4356,7 @@ namespace aux { if (i != m_uuids.end()) return i->second; return boost::weak_ptr(); } +#endif #ifndef TORRENT_DISABLE_MUTABLE_TORRENTS std::vector > session_impl::find_collection( @@ -4662,6 +4670,8 @@ namespace aux { sha1_hash const* ih = 0; sha1_hash tmp; if (params.ti) ih = ¶ms.ti->info_hash(); +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 else if (!params.url.empty()) { // in order to avoid info-hash collisions, for @@ -4672,10 +4682,13 @@ namespace aux { tmp = hasher(¶ms.url[0], params.url.size()).final(); ih = &tmp; } +#endif else ih = ¶ms.info_hash; // is the torrent already active? boost::shared_ptr torrent_ptr = find_torrent(*ih).lock(); +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 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()) @@ -4686,17 +4699,21 @@ namespace aux { if (i != m_torrents.end()) torrent_ptr = i->second; } +#endif if (torrent_ptr) { if ((params.flags & add_torrent_params::flag_duplicate_is_error) == 0) { +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 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); +#endif return torrent_handle(torrent_ptr); } @@ -4787,9 +4804,13 @@ namespace aux { #endif } #endif // TORRENT_HAS_BOOST_UNORDERED + +#ifndef TORRENT_NO_DEPRECATE + //deprecated in 1.2 if (!params.uuid.empty() || !params.url.empty()) m_uuids.insert(std::make_pair(params.uuid.empty() ? params.url : params.uuid, torrent_ptr)); +#endif // recalculate auto-managed torrents sooner (or put it off) // if another torrent will be added within one second from now @@ -4941,6 +4962,8 @@ namespace aux { void session_impl::remove_torrent_impl(boost::shared_ptr tptr, int options) { +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 // remove from uuid list if (!tptr->uuid().empty()) { @@ -4948,10 +4971,13 @@ namespace aux { = m_uuids.find(tptr->uuid()); if (j != m_uuids.end()) m_uuids.erase(j); } +#endif torrent_map::iterator i = m_torrents.find(tptr->torrent_file().info_hash()); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 // this torrent might be filed under the URL-hash if (i == m_torrents.end() && !tptr->url().empty()) { @@ -4959,6 +4985,7 @@ namespace aux { sha1_hash urlhash = hasher(&url[0], url.size()).final(); i = m_torrents.find(urlhash); } +#endif if (i == m_torrents.end()) return; diff --git a/src/torrent.cpp b/src/torrent.cpp index 996140673..8b4eb830b 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -196,9 +196,12 @@ namespace libtorrent , m_inactivity_timer(ses.get_io_service()) , m_trackerid(p.trackerid) , m_save_path(complete(p.save_path)) +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 , m_url(p.url) , m_uuid(p.uuid) , m_source_feed_url(p.source_feed_url) +#endif , m_stats_counters(ses.stats_counters()) , m_storage_constructor(p.storage) , m_added_time(time(0)) @@ -412,7 +415,10 @@ namespace libtorrent if (!p.name.empty()) m_name.reset(new std::string(p.name)); } +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (!m_url.empty() && m_uuid.empty()) m_uuid = m_url; +#endif TORRENT_ASSERT(is_single_thread()); m_file_priority = p.file_priorities; @@ -441,161 +447,8 @@ namespace libtorrent void torrent::inc_stats_counter(int c, int value) { m_ses.stats_counters().inc_stats_counter(c, value); } -#if 0 - - // NON BOTTLED VERSION. SUPPORTS PROGRESS REPORTING - - // since this download is not bottled, this callback will - // be called every time we receive another piece of the - // .torrent file - void torrent::on_torrent_download(error_code const& ec - , http_parser const& parser - , char const* data, int size) - { - if (m_abort) return; - - if (ec && ec != boost::asio::error::eof) - { - set_error(ec, error_file_url); - pause(); - return; - } - - if (size > 0) - { - m_torrent_file_buf.insert(m_torrent_file_buf.end(), data, data + size); - if (parser.content_length() > 0) - set_progress_ppm(boost::int64_t(m_torrent_file_buf.size()) - * 1000000 / parser.content_length()); - } - - if (parser.header_finished() && parser.status_code() != 200) - { - set_error(error_code(parser.status_code(), get_http_category()), error_file_url); - pause(); - return; - } - - if (!ec) return; - - // if this was received with chunked encoding, we need to strip out - // the chunk headers - size = parser.collapse_chunk_headers((char*)&m_torrent_file_buf[0], m_torrent_file_buf.size()); - m_torrent_file_buf.resize(size); - - std::string const& encoding = parser.header("content-encoding"); - if ((encoding == "gzip" || encoding == "x-gzip") && m_torrent_file_buf.size()) - { - std::vector buf; - error_code ec; - inflate_gzip(&m_torrent_file_buf[0], m_torrent_file_buf.size() - , buf, 4 * 1024 * 1024, ex); - if (ec) - { - set_error(ec, error_file_url); - pause(); - std::vector().swap(m_torrent_file_buf); - return; - } - m_torrent_file_buf.swap(buf); - } - - // we're done! - error_code e; - boost::shared_ptr tf(boost::make_shared( - &m_torrent_file_buf[0], m_torrent_file_buf.size(), e)); - if (e) - { - set_error(e, error_file_url); - pause(); - std::vector().swap(m_torrent_file_buf); - return; - } - std::vector().swap(m_torrent_file_buf); - - // update our torrent_info object and move the - // torrent from the old info-hash to the new one - // as we replace the torrent_info object -#if TORRENT_USE_ASSERTS - int num_torrents = m_ses.m_torrents.size(); -#endif - // we're about to erase the session's reference to this - // torrent, create another reference - boost::shared_ptr me(shared_from_this()); - - m_ses.remove_torrent_impl(me, 0); - - m_torrent_file = tf; - - // now, we might already have this torrent in the session. - boost::shared_ptr t = m_ses.find_torrent(m_torrent_file->info_hash()).lock(); - if (t) - { - if (!m_uuid.empty() && t->uuid().empty()) - t->set_uuid(m_uuid); - if (!m_url.empty() && t->url().empty()) - t->set_url(m_url); - if (!m_source_feed_url.empty() && t->source_feed_url().empty()) - t->set_source_feed_url(m_source_feed_url); - - // insert this torrent in the uuid index - if (!m_uuid.empty() || !m_url.empty()) - { - m_ses.insert_uuid_torrent(m_uuid.empty() ? m_url : m_uuid, t); - } - - // TODO: if the existing torrent doesn't have metadata, insert - // the metadata we just downloaded into it. - - set_error(error_code(errors::duplicate_torrent, get_libtorrent_category()), error_file_url); - abort(); - return; - } - - m_ses.insert_torrent(m_torrent_file->info_hash(), me, m_uuid); - - TORRENT_ASSERT(num_torrents == int(m_ses.m_torrents.size())); - - // if the user added any trackers while downloading the - // .torrent file, merge them into the new tracker list - std::vector new_trackers = m_torrent_file->trackers(); - for (std::vector::iterator i = m_trackers.begin() - , end(m_trackers.end()); i != end; ++i) - { - // if we already have this tracker, ignore it - if (std::find_if(new_trackers.begin(), new_trackers.end() - , boost::bind(&announce_entry::url, _1) == i->url) != new_trackers.end()) - continue; - - // insert the tracker ordered by tier - new_trackers.insert(std::find_if(new_trackers.begin(), new_trackers.end() - , boost::bind(&announce_entry::tier, _1) >= i->tier), *i); - } - m_trackers.swap(new_trackers); - -#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) - hasher h; - h.update("req2", 4); - h.update((char*)&m_torrent_file->info_hash()[0], 20); - // this is SHA1("req2" + info-hash), used for - // encrypted hand shakes - m_ses.add_obfuscated_hash(h.final(), shared_from_this()); -#endif - - if (m_ses.alerts().should_post()) - { - m_ses.alerts().emplace_alert( - get_handle()); - } - - state_updated(); - - set_state(torrent_status::downloading); - - init(); - } -#else // if 0 - +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 void torrent::on_torrent_download(error_code const& ec , http_parser const& parser, char const* data, int size) { @@ -707,7 +560,7 @@ namespace libtorrent init(); } -#endif // if 0 +#endif // TORRENT_NO_DEPRECATE int torrent::current_stats_state() const { @@ -857,7 +710,9 @@ namespace libtorrent set_limit_impl(p.upload_limit, peer_connection::upload_channel, false); set_limit_impl(p.download_limit, peer_connection::download_channel, false); +#ifndef TORRENT_NO_DEPRECATE if (!m_name && !m_url.empty()) m_name.reset(new std::string(m_url)); +#endif // if we don't have metadata, make this torrent pinned. The // client may unpin it once we have metadata and it has had @@ -884,12 +739,16 @@ namespace libtorrent update_want_tick(); update_state_list(); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (!m_torrent_file->is_valid() && !m_url.empty()) { // we need to download the .torrent file from m_url start_download_url(); } - else if (m_torrent_file->is_valid()) + else +#endif + if (m_torrent_file->is_valid()) { init(); } @@ -906,6 +765,8 @@ namespace libtorrent #endif } +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 void torrent::start_download_url() { TORRENT_ASSERT(!m_url.empty()); @@ -929,6 +790,7 @@ namespace libtorrent , 5, settings().get_str(settings_pack::user_agent)); set_state(torrent_status::downloading_metadata); } +#endif void torrent::set_apply_ip_filter(bool b) { @@ -964,10 +826,13 @@ namespace libtorrent if (!m_announce_to_dht) return false; if (!m_allow_peers) return false; +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 // if we don't have the metadata, and we're waiting // for a web server to serve it to us, no need to announce // because the info-hash is just the URL hash if (!m_torrent_file->is_valid() && !m_url.empty()) return false; +#endif // don't announce private torrents if (m_torrent_file->is_valid() && m_torrent_file->priv()) return false; @@ -2907,8 +2772,11 @@ namespace libtorrent if (!m_allow_peers) debug_log("DHT: torrent paused, no DHT announce"); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (!m_torrent_file->is_valid() && !m_url.empty()) debug_log("DHT: no info-hash, waiting for \"%s\"", m_url.c_str()); +#endif if (m_torrent_file->is_valid() && m_torrent_file->priv()) debug_log("DHT: private torrent, no DHT announce"); @@ -6759,9 +6627,12 @@ namespace libtorrent ret["save_path"] = m_save_path; +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (!m_url.empty()) ret["url"] = m_url; if (!m_uuid.empty()) ret["uuid"] = m_uuid; if (!m_source_feed_url.empty()) ret["feed"] = m_source_feed_url; +#endif const sha1_hash& info_hash = torrent_file().info_hash(); ret["info-hash"] = info_hash.to_string(); @@ -8944,12 +8815,15 @@ namespace libtorrent update_want_peers(); update_state_list(); +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 // if we haven't downloaded the metadata from m_url, try again if (!m_url.empty() && !m_torrent_file->is_valid()) { start_download_url(); return; } +#endif // if the error happened during initialization, try again now if (!m_connections_initialized && valid_metadata()) init(); if (!checking_files && should_check_files()) @@ -8958,7 +8832,10 @@ namespace libtorrent std::string torrent::resolve_filename(int file) const { if (file == torrent_status::error_file_none) return ""; +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (file == torrent_status::error_file_url) return m_url; +#endif if (file == torrent_status::error_file_ssl_ctx) return "SSL Context"; if (file == torrent_status::error_file_metadata) return "metadata (from user load function)"; @@ -9653,6 +9530,8 @@ namespace libtorrent #endif return; } +#ifndef TORRENT_NO_DEPRECATE + // deprecated in 1.2 if (!m_torrent_file->is_valid() && !m_url.empty()) { #ifndef TORRENT_DISABLE_LOGGING @@ -9660,6 +9539,7 @@ namespace libtorrent #endif return; } +#endif if (m_announcing) return; m_announcing = true;