merged RC_1_1 into master
This commit is contained in:
commit
267ca40b28
|
@ -84,15 +84,20 @@
|
||||||
* resume data no longer has timestamps of files
|
* resume data no longer has timestamps of files
|
||||||
* require C++11 to build libtorrent
|
* require C++11 to build libtorrent
|
||||||
|
|
||||||
|
* improve error handling of failing to change file priority
|
||||||
|
The API for custom storage implementations was altered
|
||||||
* set the hidden attribute when creating the part file
|
* set the hidden attribute when creating the part file
|
||||||
|
* fix tracker announces reporting more data downloaded than the size of the torrent
|
||||||
* fix recent regression with force_proxy setting
|
* fix recent regression with force_proxy setting
|
||||||
|
|
||||||
|
1.1.7 release
|
||||||
|
|
||||||
* don't perform DNS lookups for the DHT bootstrap unless DHT is enabled
|
* don't perform DNS lookups for the DHT bootstrap unless DHT is enabled
|
||||||
* fix issue where setting file/piece priority would stop checking
|
* fix issue where setting file/piece priority would stop checking
|
||||||
* expose post_dht_stats() to python binding
|
* expose post_dht_stats() to python binding
|
||||||
* fix backwards compatibility to downloads without partfiles
|
* fix backwards compatibility to downloads without partfiles
|
||||||
* improve part-file related error messages
|
* improve part-file related error messages
|
||||||
* fix reporting &redundant= in tracker announces
|
* fix reporting &redundant= in tracker announces
|
||||||
* fix tracker announces reporting more data downloaded than the size of the torrent
|
|
||||||
* fix tie-break in duplicate peer connection disconnect logic
|
* fix tie-break in duplicate peer connection disconnect logic
|
||||||
* fix issue with SSL tracker connections left in CLOSE_WAIT state
|
* fix issue with SSL tracker connections left in CLOSE_WAIT state
|
||||||
* defer truncating existing files until the first time we write to them
|
* defer truncating existing files until the first time we write to them
|
||||||
|
|
|
@ -172,7 +172,7 @@ namespace libtorrent {
|
||||||
, std::function<void(storage_error const&)> handler) = 0;
|
, std::function<void(storage_error const&)> handler) = 0;
|
||||||
virtual void async_set_file_priority(storage_index_t storage
|
virtual void async_set_file_priority(storage_index_t storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prio
|
, aux::vector<download_priority_t, file_index_t> prio
|
||||||
, std::function<void(storage_error const&)> handler) = 0;
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler) = 0;
|
||||||
|
|
||||||
virtual void async_clear_piece(storage_index_t storage, piece_index_t index
|
virtual void async_clear_piece(storage_index_t storage, piece_index_t index
|
||||||
, std::function<void(piece_index_t)> handler) = 0;
|
, std::function<void(piece_index_t)> handler) = 0;
|
||||||
|
|
|
@ -140,6 +140,7 @@ namespace libtorrent {
|
||||||
using check_handler = std::function<void(status_t, storage_error const&)>;
|
using check_handler = std::function<void(status_t, storage_error const&)>;
|
||||||
using rename_handler = std::function<void(std::string, file_index_t, storage_error const&)>;
|
using rename_handler = std::function<void(std::string, file_index_t, storage_error const&)>;
|
||||||
using clear_piece_handler = std::function<void(piece_index_t)>;
|
using clear_piece_handler = std::function<void(piece_index_t)>;
|
||||||
|
using set_file_prio_handler = std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)>;
|
||||||
|
|
||||||
boost::variant<read_handler
|
boost::variant<read_handler
|
||||||
, write_handler
|
, write_handler
|
||||||
|
@ -148,7 +149,8 @@ namespace libtorrent {
|
||||||
, release_handler
|
, release_handler
|
||||||
, check_handler
|
, check_handler
|
||||||
, rename_handler
|
, rename_handler
|
||||||
, clear_piece_handler> callback;
|
, clear_piece_handler
|
||||||
|
, set_file_prio_handler> callback;
|
||||||
|
|
||||||
// the error code from the file operation
|
// the error code from the file operation
|
||||||
// on error, this also contains the path of the
|
// on error, this also contains the path of the
|
||||||
|
|
|
@ -324,7 +324,7 @@ namespace aux {
|
||||||
, std::function<void()> handler = std::function<void()>()) override;
|
, std::function<void()> handler = std::function<void()>()) override;
|
||||||
void async_set_file_priority(storage_index_t storage
|
void async_set_file_priority(storage_index_t storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prio
|
, aux::vector<download_priority_t, file_index_t> prio
|
||||||
, std::function<void(storage_error const&)> handler) override;
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler) override;
|
||||||
|
|
||||||
void async_clear_piece(storage_index_t storage, piece_index_t index
|
void async_clear_piece(storage_index_t storage, piece_index_t index
|
||||||
, std::function<void(piece_index_t)> handler) override;
|
, std::function<void(piece_index_t)> handler) override;
|
||||||
|
|
|
@ -232,7 +232,7 @@ namespace libtorrent {
|
||||||
// change the priorities of files. This is a fenced job and is
|
// change the priorities of files. This is a fenced job and is
|
||||||
// guaranteed to be the only running function on this storage
|
// guaranteed to be the only running function on this storage
|
||||||
// when called
|
// when called
|
||||||
virtual void set_file_priority(aux::vector<download_priority_t, file_index_t> const& prio
|
virtual void set_file_priority(aux::vector<download_priority_t, file_index_t>& prio
|
||||||
, storage_error& ec) = 0;
|
, storage_error& ec) = 0;
|
||||||
|
|
||||||
// This function should move all the files belonging to the storage to
|
// This function should move all the files belonging to the storage to
|
||||||
|
@ -390,7 +390,7 @@ namespace libtorrent {
|
||||||
~default_storage() override;
|
~default_storage() override;
|
||||||
|
|
||||||
bool has_any_file(storage_error& ec) override;
|
bool has_any_file(storage_error& ec) override;
|
||||||
void set_file_priority(aux::vector<download_priority_t, file_index_t> const& prio
|
void set_file_priority(aux::vector<download_priority_t, file_index_t>& prio
|
||||||
, storage_error& ec) override;
|
, storage_error& ec) override;
|
||||||
void rename_file(file_index_t index, std::string const& new_filename
|
void rename_file(file_index_t index, std::string const& new_filename
|
||||||
, storage_error& ec) override;
|
, storage_error& ec) override;
|
||||||
|
|
|
@ -569,7 +569,7 @@ namespace libtorrent {
|
||||||
void set_file_priority(file_index_t index, download_priority_t priority);
|
void set_file_priority(file_index_t index, download_priority_t priority);
|
||||||
download_priority_t file_priority(file_index_t index) const;
|
download_priority_t file_priority(file_index_t index) const;
|
||||||
|
|
||||||
void on_file_priority(storage_error const&);
|
void on_file_priority(storage_error const& err, aux::vector<download_priority_t, file_index_t> const& prios);
|
||||||
void prioritize_files(aux::vector<download_priority_t, file_index_t> const& files);
|
void prioritize_files(aux::vector<download_priority_t, file_index_t> const& files);
|
||||||
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
void file_priorities(aux::vector<download_priority_t, file_index_t>*) const;
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,12 @@ namespace libtorrent {
|
||||||
h(m_job.piece);
|
h(m_job.piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void operator()(disk_io_job::set_file_prio_handler& h) const
|
||||||
|
{
|
||||||
|
if (!h) return;
|
||||||
|
h(m_job.error, boost::get<aux::vector<download_priority_t, file_index_t>>(m_job.argument));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
disk_io_job& m_job;
|
disk_io_job& m_job;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1922,7 +1922,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
|
||||||
|
|
||||||
void disk_io_thread::async_set_file_priority(storage_index_t const storage
|
void disk_io_thread::async_set_file_priority(storage_index_t const storage
|
||||||
, aux::vector<download_priority_t, file_index_t> prios
|
, aux::vector<download_priority_t, file_index_t> prios
|
||||||
, std::function<void(storage_error const&)> handler)
|
, std::function<void(storage_error const&, aux::vector<download_priority_t, file_index_t> const&)> handler)
|
||||||
{
|
{
|
||||||
disk_io_job* j = allocate_job(job_action_t::file_priority);
|
disk_io_job* j = allocate_job(job_action_t::file_priority);
|
||||||
j->storage = m_torrents[storage]->shared_from_this();
|
j->storage = m_torrents[storage]->shared_from_this();
|
||||||
|
@ -2733,7 +2733,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
|
||||||
status_t disk_io_thread::do_file_priority(disk_io_job* j, jobqueue_t& /* completed_jobs */ )
|
status_t disk_io_thread::do_file_priority(disk_io_job* j, jobqueue_t& /* completed_jobs */ )
|
||||||
{
|
{
|
||||||
j->storage->set_file_priority(
|
j->storage->set_file_priority(
|
||||||
boost::get<aux::vector<download_priority_t, file_index_t>>(j->argument)
|
boost::get<aux::vector<download_priority_t, file_index_t>&>(j->argument)
|
||||||
, j->error);
|
, j->error);
|
||||||
return status_t::no_error;
|
return status_t::no_error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace libtorrent {
|
||||||
}
|
}
|
||||||
|
|
||||||
void default_storage::set_file_priority(
|
void default_storage::set_file_priority(
|
||||||
aux::vector<download_priority_t, file_index_t> const& prio
|
aux::vector<download_priority_t, file_index_t>& prio
|
||||||
, storage_error& ec)
|
, storage_error& ec)
|
||||||
{
|
{
|
||||||
// extend our file priorities in case it's truncated
|
// extend our file priorities in case it's truncated
|
||||||
|
@ -135,6 +135,7 @@ namespace libtorrent {
|
||||||
{
|
{
|
||||||
ec.file(i);
|
ec.file(i);
|
||||||
ec.operation = operation_t::file_open;
|
ec.operation = operation_t::file_open;
|
||||||
|
prio = m_file_priority;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +153,7 @@ namespace libtorrent {
|
||||||
{
|
{
|
||||||
ec.file(i);
|
ec.file(i);
|
||||||
ec.operation = operation_t::partfile_write;
|
ec.operation = operation_t::partfile_write;
|
||||||
|
prio = m_file_priority;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,7 +170,13 @@ namespace libtorrent {
|
||||||
file_handle f = open_file(i, open_mode::read_only, ec);
|
file_handle f = open_file(i, open_mode::read_only, ec);
|
||||||
if (ec.ec != boost::system::errc::no_such_file_or_directory)
|
if (ec.ec != boost::system::errc::no_such_file_or_directory)
|
||||||
{
|
{
|
||||||
if (ec) return;
|
if (ec)
|
||||||
|
{
|
||||||
|
ec.file = i;
|
||||||
|
ec.operation = storage_error::open;
|
||||||
|
prio = m_file_priority;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
need_partfile();
|
need_partfile();
|
||||||
|
|
||||||
|
@ -177,6 +185,7 @@ namespace libtorrent {
|
||||||
{
|
{
|
||||||
ec.file(i);
|
ec.file(i);
|
||||||
ec.operation = operation_t::partfile_read;
|
ec.operation = operation_t::partfile_read;
|
||||||
|
prio = m_file_priority;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// remove the file
|
// remove the file
|
||||||
|
@ -186,6 +195,8 @@ namespace libtorrent {
|
||||||
{
|
{
|
||||||
ec.file(i);
|
ec.file(i);
|
||||||
ec.operation = operation_t::file_remove;
|
ec.operation = operation_t::file_remove;
|
||||||
|
prio = m_file_priority;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -737,7 +748,7 @@ namespace {
|
||||||
explicit disabled_storage(file_storage const& fs) : storage_interface(fs) {}
|
explicit disabled_storage(file_storage const& fs) : storage_interface(fs) {}
|
||||||
|
|
||||||
bool has_any_file(storage_error&) override { return false; }
|
bool has_any_file(storage_error&) override { return false; }
|
||||||
void set_file_priority(aux::vector<download_priority_t, file_index_t> const&
|
void set_file_priority(aux::vector<download_priority_t, file_index_t>&
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
void rename_file(file_index_t, std::string const&, storage_error&) override {}
|
void rename_file(file_index_t, std::string const&, storage_error&) override {}
|
||||||
void release_files(storage_error&) override {}
|
void release_files(storage_error&) override {}
|
||||||
|
@ -799,7 +810,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_any_file(storage_error&) override { return false; }
|
bool has_any_file(storage_error&) override { return false; }
|
||||||
void set_file_priority(aux::vector<download_priority_t, file_index_t> const& /* prio */
|
void set_file_priority(aux::vector<download_priority_t, file_index_t>& /* prio */
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
status_t move_storage(std::string const& /* save_path */
|
status_t move_storage(std::string const& /* save_path */
|
||||||
, move_flags_t, storage_error&) override { return status_t::no_error; }
|
, move_flags_t, storage_error&) override { return status_t::no_error; }
|
||||||
|
|
|
@ -5014,7 +5014,23 @@ bool is_downloading_state(int const st)
|
||||||
m_picker->piece_priorities(*pieces);
|
m_picker->piece_priorities(*pieces);
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::on_file_priority(storage_error const&) {}
|
void torrent::on_file_priority(storage_error const& err
|
||||||
|
, aux::vector<download_priority_t, file_index_t> const& prios)
|
||||||
|
{
|
||||||
|
COMPLETE_ASYNC("file_priority");
|
||||||
|
if (m_file_priority == prios) return;
|
||||||
|
|
||||||
|
// in this case, some file priorities failed to get set
|
||||||
|
m_file_priority = prios;
|
||||||
|
update_piece_priorities();
|
||||||
|
|
||||||
|
if (alerts().should_post<file_error_alert>())
|
||||||
|
alerts().emplace_alert<file_error_alert>(err.ec
|
||||||
|
, resolve_filename(err.file()), err.operation, get_handle());
|
||||||
|
|
||||||
|
set_error(err.ec, err.file());
|
||||||
|
pause();
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::prioritize_files(aux::vector<download_priority_t, file_index_t> const& files)
|
void torrent::prioritize_files(aux::vector<download_priority_t, file_index_t> const& files)
|
||||||
{
|
{
|
||||||
|
@ -5041,8 +5057,9 @@ bool is_downloading_state(int const st)
|
||||||
// storage may be nullptr during construction and shutdown
|
// storage may be nullptr during construction and shutdown
|
||||||
if (m_torrent_file->num_pieces() > 0 && m_storage)
|
if (m_torrent_file->num_pieces() > 0 && m_storage)
|
||||||
{
|
{
|
||||||
|
ADD_OUTSTANDING_ASYNC("file_priority");
|
||||||
m_ses.disk_thread().async_set_file_priority(m_storage
|
m_ses.disk_thread().async_set_file_priority(m_storage
|
||||||
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1));
|
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
update_piece_priorities();
|
update_piece_priorities();
|
||||||
|
@ -5080,8 +5097,9 @@ bool is_downloading_state(int const st)
|
||||||
// storage may be nullptr during shutdown
|
// storage may be nullptr during shutdown
|
||||||
if (m_storage)
|
if (m_storage)
|
||||||
{
|
{
|
||||||
|
ADD_OUTSTANDING_ASYNC("file_priority");
|
||||||
m_ses.disk_thread().async_set_file_priority(m_storage
|
m_ses.disk_thread().async_set_file_priority(m_storage
|
||||||
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1));
|
, m_file_priority, std::bind(&torrent::on_file_priority, shared_from_this(), _1, _2));
|
||||||
}
|
}
|
||||||
update_piece_priorities();
|
update_piece_priorities();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct test_storage_impl : storage_interface
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_any_file(storage_error&) override { return false; }
|
bool has_any_file(storage_error&) override { return false; }
|
||||||
void set_file_priority(aux::vector<download_priority_t, file_index_t> const&
|
void set_file_priority(aux::vector<download_priority_t, file_index_t>&
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
status_t move_storage(std::string const&, move_flags_t
|
status_t move_storage(std::string const&, move_flags_t
|
||||||
, storage_error&) override { return status_t::no_error; }
|
, storage_error&) override { return status_t::no_error; }
|
||||||
|
|
|
@ -79,7 +79,7 @@ struct test_storage : default_storage
|
||||||
, m_limit(16 * 1024 * 2)
|
, m_limit(16 * 1024 * 2)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void set_file_priority(aux::vector<download_priority_t, file_index_t> const&
|
void set_file_priority(aux::vector<download_priority_t, file_index_t>&
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
|
|
||||||
void set_limit(int lim)
|
void set_limit(int lim)
|
||||||
|
|
Loading…
Reference in New Issue