From 62fb7209ef5e98d5e94d7fdee2f1495c6ee84c78 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 22 May 2016 22:58:11 -0400 Subject: [PATCH] fix invariant check issue with a paused session (#750) fix invariant check issue with a paused session --- src/torrent.cpp | 6 +++++- test/test_session.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index 911b0a828..8769d2b55 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -9986,7 +9986,11 @@ namespace libtorrent void torrent::do_resume() { TORRENT_ASSERT(is_single_thread()); - if (is_paused()) return; + if (is_paused()) + { + update_want_tick(); + return; + } #ifndef TORRENT_DISABLE_EXTENSIONS for (extension_list_t::iterator i = m_extensions.begin() diff --git a/test/test_session.cpp b/test/test_session.cpp index e062ec69e..21a88f6bb 100644 --- a/test/test_session.cpp +++ b/test/test_session.cpp @@ -48,6 +48,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/bencode.hpp" #include "libtorrent/torrent_info.hpp" +#include + using namespace libtorrent; namespace lt = libtorrent; @@ -137,7 +139,8 @@ TORRENT_TEST(paused_session) s.pause(); lt::add_torrent_params ps; - ps.info_hash.assign("abababababababababab"); + std::ofstream file("temporary"); + ps.ti = ::create_torrent(&file, "temporary", 16 * 1024, 13, false); ps.flags = lt::add_torrent_params::flag_paused; ps.save_path = ".";