lt sync 2749
This commit is contained in:
parent
c57939baa2
commit
4f846d6f7c
|
@ -142,6 +142,7 @@ namespace libtorrent
|
|||
, max_peerlist_size(8000)
|
||||
, min_announce_interval(5 * 60)
|
||||
, prioritize_partial_pieces(false)
|
||||
, auto_manage_startup(120)
|
||||
{}
|
||||
|
||||
// this is the user agent that will be sent to the tracker
|
||||
|
@ -441,6 +442,14 @@ namespace libtorrent
|
|||
// if true, partial pieces are picked before pieces
|
||||
// that are more rare
|
||||
bool prioritize_partial_pieces;
|
||||
|
||||
// the number of seconds a torrent is considered
|
||||
// active after it was started, regardless of
|
||||
// upload and download speed. This is so that
|
||||
// newly started torrents are not considered
|
||||
// inactive until they have a fair chance to
|
||||
// start downloading.
|
||||
int auto_manage_startup;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -217,6 +217,7 @@ namespace libtorrent
|
|||
void pause();
|
||||
void resume();
|
||||
|
||||
ptime started() const { return m_started; }
|
||||
void do_pause();
|
||||
void do_resume();
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ namespace libtorrent
|
|||
~torrent_info();
|
||||
|
||||
file_storage const& files() const { return m_files; }
|
||||
file_storage& files() { return m_files; }
|
||||
|
||||
void add_tracker(std::string const& url, int tier = 0);
|
||||
std::vector<announce_entry> const& trackers() const { return m_urls; }
|
||||
|
|
|
@ -1283,7 +1283,8 @@ namespace aux {
|
|||
{
|
||||
return !(s.dont_count_slow_torrents
|
||||
&& t->statistics().upload_payload_rate() == 0.f
|
||||
&& t->statistics().download_payload_rate() == 0.f);
|
||||
&& t->statistics().download_payload_rate() == 0.f
|
||||
&& time_now() - t->started() > seconds(s.auto_manage_startup));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#if BOOST_VERSION >= 103500
|
||||
#include <boost/system/system_error.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
@ -581,7 +584,11 @@ namespace libtorrent
|
|||
try
|
||||
{
|
||||
#endif
|
||||
rename(old_path, new_path);
|
||||
// if old path doesn't exist, just rename the file
|
||||
// in our file_storage, so that when it is created
|
||||
// it will get the new name
|
||||
create_directories(new_path.branch_path());
|
||||
if (exists(old_path)) rename(old_path, new_path);
|
||||
/*
|
||||
error_code ec;
|
||||
rename(old_path, new_path, ec);
|
||||
|
@ -596,6 +603,13 @@ namespace libtorrent
|
|||
m_mapped_files->rename_file(index, new_filename);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
#if BOOST_VERSION >= 103500
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
set_error(old_name, e.code());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
catch (std::exception& e)
|
||||
{
|
||||
set_error(old_name, error_code(errno, get_posix_category()));
|
||||
|
@ -726,15 +740,6 @@ namespace libtorrent
|
|||
m_file_priority[i] = file_priority->list_int_value_at(i, 1);
|
||||
}
|
||||
|
||||
lazy_entry const* mapped_files = rd.dict_find_list("mapped_files");
|
||||
if (mapped_files && mapped_files->list_size() == m_files.num_files())
|
||||
{
|
||||
if (!m_mapped_files)
|
||||
{ m_mapped_files.reset(new file_storage(m_files)); }
|
||||
for (int i = 0; i < m_files.num_files(); ++i)
|
||||
m_mapped_files->rename_file(i, mapped_files->list_string_value_at(i));
|
||||
}
|
||||
|
||||
std::vector<std::pair<size_type, std::time_t> > file_sizes;
|
||||
lazy_entry const* file_sizes_ent = rd.dict_find_list("file sizes");
|
||||
if (file_sizes_ent == 0)
|
||||
|
|
|
@ -1659,6 +1659,7 @@ namespace libtorrent
|
|||
{
|
||||
if (alerts().should_post<file_renamed_alert>())
|
||||
alerts().post_alert(file_renamed_alert(get_handle(), j.str, j.piece));
|
||||
m_torrent_file->files().rename_file(j.piece, j.str);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2549,6 +2550,17 @@ namespace libtorrent
|
|||
< boost::bind(&announce_entry::tier, _2));
|
||||
}
|
||||
|
||||
lazy_entry const* mapped_files = rd.dict_find_list("mapped_files");
|
||||
if (mapped_files && mapped_files->list_size() == m_torrent_file->num_files())
|
||||
{
|
||||
for (int i = 0; i < m_torrent_file->num_files(); ++i)
|
||||
{
|
||||
std::string new_filename = mapped_files->list_string_value_at(i);
|
||||
if (new_filename.empty()) continue;
|
||||
m_torrent_file->files().rename_file(i, new_filename);
|
||||
}
|
||||
}
|
||||
|
||||
lazy_entry const* url_list = rd.dict_find_list("url-list");
|
||||
if (url_list)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue