diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 85a6e3bac..9403631d1 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -39,11 +39,15 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include #include #include #include +#ifndef TORRENT_NO_DEPRECATE +// for deprecated force_reannounce +#include +#endif + #include "libtorrent/aux_/disable_warnings_pop.hpp" #include "libtorrent/peer_id.hpp" @@ -1331,13 +1335,17 @@ namespace libtorrent // ``torrent_handle::query_torrent_file``. boost::weak_ptr torrent_file; - // TODO: 3 don't use boost.date-time types here. use chrono types // the time until the torrent will announce itself to the tracker. - boost::posix_time::time_duration next_announce; + time_duration next_announce; +#ifdef TORRENT_NO_DEPRECATE // the time the tracker want us to wait until we announce ourself // again the next time. - boost::posix_time::time_duration announce_interval; + time_duration announce_interval; +#else + // leave this here for ABI stability + time_duration deprecated_announce_interval_; +#endif // the URL of the last working tracker. If no tracker request has // been successful yet, it's set to an empty string. diff --git a/src/torrent.cpp b/src/torrent.cpp index a66fd2f2b..335c16ddc 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -11432,21 +11432,23 @@ namespace libtorrent st->upload_payload_rate = m_stat.upload_payload_rate(); if (m_waiting_tracker && !is_paused()) - st->next_announce = boost::posix_time::seconds( - total_seconds(next_announce() - now)); + st->next_announce = next_announce() - now; else - st->next_announce = boost::posix_time::seconds(0); + st->next_announce = seconds(0); - if (st->next_announce.is_negative()) - st->next_announce = boost::posix_time::seconds(0); + if (st->next_announce.count() < 0) + st->next_announce = seconds(0); - st->announce_interval = boost::posix_time::seconds(0); +#ifdef TORRENT_NO_DEPRECATE + st->announce_interval = seconds(0); +#endif st->current_tracker.clear(); if (m_last_working_tracker >= 0) { TORRENT_ASSERT(m_last_working_tracker < int(m_trackers.size())); - st->current_tracker = m_trackers[m_last_working_tracker].url; + const int i = m_last_working_tracker; + st->current_tracker = m_trackers[i].url; } else {