merged RC_1_1 into master

This commit is contained in:
arvidn 2016-05-23 00:45:57 -04:00
commit f1216686d2
6 changed files with 54 additions and 8 deletions

View File

@ -287,8 +287,12 @@ namespace libtorrent {
time_point m_timestamp;
};
// When you get an alert, you can use ``alert_cast<>`` to attempt to cast the pointer to a
// more specific alert type, in order to query it for more information.
// When you get an alert, you can use ``alert_cast<>`` to attempt to cast the
// pointer to a specific alert type, in order to query it for more
// information.
//
// .. note::
// ``alert_cast<>`` can only cast to an exact alert type, not a base class
template <class T> T* alert_cast(alert* a)
{
if (a == nullptr) return nullptr;

View File

@ -2522,8 +2522,12 @@ namespace aux {
{
// now, disconnect a random peer
torrent_map::iterator i = std::max_element(m_torrents.begin()
, m_torrents.end(), boost::bind(&torrent::num_peers
, boost::bind(&torrent_map::value_type::second, _1)));
, m_torrents.end()
, boost::bind(&torrent::num_peers
, boost::bind(&torrent_map::value_type::second, _1))
< boost::bind(&torrent::num_peers
, boost::bind(&torrent_map::value_type::second, _2))
);
if (m_alerts.should_post<performance_alert>())
m_alerts.emplace_alert<performance_alert>(

View File

@ -9243,7 +9243,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 (auto& ext : m_extensions)

View File

@ -75,11 +75,9 @@ lib libtorrent_test
<toolset>darwin:<cflags>-Wno-unused-command-line-argument
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
<toolset>msvc:<cflags>/wd4275
<debug-iterators>on
: # default build
<link>shared
<logging>on
: # user-requirements
<link>shared:<define>TORRENT_LINK_TEST_SHARED
@ -103,6 +101,8 @@ project
<invariant-checks>full
<link>shared
<picker-debugging>on
<debug-iterators>on
<logging>on
;
feature launcher : none valgrind : composite ;

View File

@ -31,7 +31,13 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/session.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "test.hpp"
#include "setup_transfer.hpp"
@ -42,6 +48,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bencode.hpp"
#include "libtorrent/torrent_info.hpp"
#include <fstream>
using namespace libtorrent;
namespace lt = libtorrent;
@ -151,7 +159,7 @@ TORRENT_TEST(load_empty_file)
add_torrent_params atp;
error_code ignore_errors;
atp.ti = boost::make_shared<torrent_info>("", 0, ignore_errors);
atp.ti = boost::make_shared<torrent_info>("", 0, boost::ref(ignore_errors));
atp.save_path = ".";
error_code ec;
torrent_handle h = ses.add_torrent(atp, ec);
@ -175,6 +183,26 @@ TORRENT_TEST(session_stats)
}
}
TORRENT_TEST(paused_session)
{
lt::session s;
s.pause();
lt::add_torrent_params ps;
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 = ".";
torrent_handle h = s.add_torrent(ps);
test_sleep(2000);
h.resume();
test_sleep(1000);
TEST_CHECK(!h.status().paused);
}
template <typename Set, typename Save, typename Default, typename Load>
void test_save_restore(Set setup, Save s, Default d, Load l)
{

View File

@ -36,7 +36,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/aux_/escape_string.hpp" // for convert_path_to_posix
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/make_shared.hpp>
#include <boost/ref.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#if TORRENT_USE_IOSTREAM
#include <sstream>