merged RC_1_1 into master

This commit is contained in:
arvidn 2017-07-13 19:55:29 -07:00
commit c692147c94
5 changed files with 48 additions and 18 deletions

View File

@ -74,6 +74,8 @@
* resume data no longer has timestamps of files
* require C++11 to build libtorrent
* fix inconsistency in file_priorities and override_resume_data behavior
1.1.4 release
* corrected missing const qualifiers on bdecode_node

View File

@ -234,8 +234,7 @@ namespace libtorrent {
// add_torrent_params configuring the torrent override the corresponding
// configuration from the resume file, with the one exception of save
// resume data, which has its own flag (for historic reasons).
// If this flag is set, but file_priorities is empty, file priorities
// are still loaded from the resume data, if present.
// "file_priorities" and "save_path" are not affected by this flag.
flag_override_resume_data TORRENT_DEPRECATED_ENUM = 0x20000,
// defaults to on and specifies whether tracker URLs loaded from
@ -335,7 +334,9 @@ namespace libtorrent {
// can be set to control the initial file priorities when adding a
// torrent. The semantics are the same as for
// ``torrent_handle::prioritize_files()``.
// ``torrent_handle::prioritize_files()``. The file priorities specified
// in here take precedence over those specified in the resume data, if
// any.
aux::noexcept_movable<std::vector<std::uint8_t>> file_priorities;
// torrent extension construction functions can be added to this vector

View File

@ -33,19 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_EXPORT_HPP_INCLUDED
#define TORRENT_EXPORT_HPP_INCLUDED
#if !defined(BOOST_COMPILER_CONFIG) && !defined(BOOST_NO_COMPILER_CONFIG)
# include <boost/config/select_compiler_config.hpp>
#endif
#ifdef BOOST_COMPILER_CONFIG
# include BOOST_COMPILER_CONFIG
#endif
#if !defined(BOOST_PLATFORM_CONFIG) && !defined(BOOST_NO_PLATFORM_CONFIG)
# include <boost/config/select_platform_config.hpp>
#endif
#ifdef BOOST_PLATFORM_CONFIG
# include BOOST_PLATFORM_CONFIG
#endif
#include <boost/config.hpp>
// backwards compatibility with older versions of boost
#if !defined BOOST_SYMBOL_EXPORT && !defined BOOST_SYMBOL_IMPORT

View File

@ -4940,7 +4940,7 @@ namespace libtorrent {
if (m_torrent_file->num_pieces() > 0 && m_storage)
{
m_ses.disk_thread().async_set_file_priority(m_storage
, m_file_priority, std::bind(&torrent::on_file_priority, this, _1));
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1));
}
update_piece_priorities();
@ -4979,7 +4979,7 @@ namespace libtorrent {
if (m_storage)
{
m_ses.disk_thread().async_set_file_priority(m_storage
, m_file_priority, std::bind(&torrent::on_file_priority, this, _1));
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1));
}
update_piece_priorities();
}

View File

@ -290,6 +290,45 @@ TORRENT_TEST(file_priorities_default_deprecated)
TEST_EQUAL(file_priorities[2], 4);
}
// As long as the add_torrent_params priorities are empty, the file_priorities
// from the resume data should take effect
TORRENT_TEST(file_priorities_in_resume_deprecated)
{
lt::session ses(settings());
std::vector<int> file_priorities = test_resume_flags(ses, 0, "", "123").file_priorities();
TEST_EQUAL(file_priorities.size(), 3);
TEST_EQUAL(file_priorities[0], 1);
TEST_EQUAL(file_priorities[1], 2);
TEST_EQUAL(file_priorities[2], 3);
}
// if both resume data and add_torrent_params has file_priorities, the
// add_torrent_params one take precedence
TORRENT_TEST(file_priorities_in_resume_and_params_deprecated)
{
lt::session ses(settings());
std::vector<int> file_priorities = test_resume_flags(ses, 0, "456", "123").file_priorities();
TEST_EQUAL(file_priorities.size(), 3);
TEST_EQUAL(file_priorities[0], 4);
TEST_EQUAL(file_priorities[1], 5);
TEST_EQUAL(file_priorities[2], 6);
}
// if we set flag_override_resume_data, it should no affect file priorities
TORRENT_TEST(file_priorities_override_resume_deprecated)
{
lt::session ses(settings());
std::vector<int> file_priorities = test_resume_flags(ses
, add_torrent_params::flag_override_resume_data, "", "123").file_priorities();
TEST_EQUAL(file_priorities.size(), 3);
TEST_EQUAL(file_priorities[0], 1);
TEST_EQUAL(file_priorities[1], 2);
TEST_EQUAL(file_priorities[2], 3);
}
TORRENT_TEST(file_priorities_resume_seed_mode_deprecated)
{
// in share mode file priorities should always be 0