forked from premiere/premiere-libtorrent
deprecate torrent::set_ratio
This commit is contained in:
parent
0370fb7632
commit
78f16cedd9
|
@ -1,3 +1,4 @@
|
|||
* deprecate set_ratio()
|
||||
* add web seed support for torrents with pad files
|
||||
* introduced a more scalable API for torrent status updates (post_torrent_updates())
|
||||
* updated the API to add_torrent_params turning all bools into flags of a flags field
|
||||
|
|
|
@ -2287,7 +2287,6 @@ Its declaration looks like this::
|
|||
void remove_http_seed(std::string const& url);
|
||||
std::set<std::string> http_seeds() const;
|
||||
|
||||
void set_ratio(float ratio) const;
|
||||
int max_uploads() const;
|
||||
void set_max_uploads(int max_uploads) const;
|
||||
void set_max_connections(int max_connections) const;
|
||||
|
@ -2700,23 +2699,6 @@ case the torrent was started without metadata, and hasn't completely received it
|
|||
it returns the name given to it when added to the session. See ``session::add_torrent``.
|
||||
|
||||
|
||||
set_ratio()
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
void set_ratio(float ratio) const;
|
||||
|
||||
``set_ratio()`` sets the desired download / upload ratio. If set to 0, it is considered being
|
||||
infinite. i.e. the client will always upload as much as it can, no matter how much it gets back
|
||||
in return. With this setting it will work much like the standard clients.
|
||||
|
||||
Besides 0, the ratio can be set to any number greater than or equal to 1. It means how much to
|
||||
attempt to upload in return for each download. e.g. if set to 2, the client will try to upload
|
||||
2 bytes for every byte received. The default setting for this is 0, which will make it work
|
||||
as a standard client.
|
||||
|
||||
|
||||
set_upload_limit() set_download_limit() upload_limit() download_limit()
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -639,7 +639,6 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
|
|||
}
|
||||
|
||||
int listen_port = 6881;
|
||||
float preferred_ratio = 0.f;
|
||||
int allocation_mode = libtorrent::storage_mode_sparse;
|
||||
std::string save_path(".");
|
||||
int torrent_upload_limit = 0;
|
||||
|
@ -664,7 +663,6 @@ void add_torrent(libtorrent::session& ses
|
|||
, handles_t& files
|
||||
, std::set<libtorrent::torrent_handle>& non_files
|
||||
, std::string const& torrent
|
||||
, float preferred_ratio
|
||||
, int allocation_mode
|
||||
, std::string const& save_path
|
||||
, bool monitored_dir
|
||||
|
@ -715,7 +713,6 @@ void add_torrent(libtorrent::session& ses
|
|||
|
||||
h.set_max_connections(max_connections_per_torrent);
|
||||
h.set_max_uploads(-1);
|
||||
h.set_ratio(preferred_ratio);
|
||||
h.set_upload_limit(torrent_upload_limit);
|
||||
h.set_download_limit(torrent_download_limit);
|
||||
h.use_interface(outgoing_interface.c_str());
|
||||
|
@ -728,7 +725,6 @@ void scan_dir(std::string const& dir_path
|
|||
, libtorrent::session& ses
|
||||
, handles_t& files
|
||||
, std::set<libtorrent::torrent_handle>& non_files
|
||||
, float preferred_ratio
|
||||
, int allocation_mode
|
||||
, std::string const& save_path
|
||||
, int torrent_upload_limit
|
||||
|
@ -753,7 +749,7 @@ void scan_dir(std::string const& dir_path
|
|||
|
||||
// the file has been added to the dir, start
|
||||
// downloading it.
|
||||
add_torrent(ses, files, non_files, file, preferred_ratio, allocation_mode
|
||||
add_torrent(ses, files, non_files, file, allocation_mode
|
||||
, save_path, true, torrent_upload_limit, torrent_download_limit);
|
||||
valid.insert(file);
|
||||
}
|
||||
|
@ -895,7 +891,6 @@ void handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
|||
|
||||
h.set_max_connections(max_connections_per_torrent);
|
||||
h.set_max_uploads(-1);
|
||||
h.set_ratio(preferred_ratio);
|
||||
h.set_upload_limit(torrent_upload_limit);
|
||||
h.set_download_limit(torrent_download_limit);
|
||||
h.use_interface(outgoing_interface.c_str());
|
||||
|
@ -1058,7 +1053,6 @@ int main(int argc, char* argv[])
|
|||
" -H Don't start DHT\n"
|
||||
" -n announce to trackers in all tiers\n"
|
||||
" -W <num peers> Set the max number of peers to keep in the peer list\n"
|
||||
" -r <ratio> sets the preferred share ratio\n"
|
||||
" -B <seconds> sets the peer timeout\n"
|
||||
" -Q enables share mode. Share mode attempts to maximize\n"
|
||||
" share ratio rather than downloading\n"
|
||||
|
@ -1204,10 +1198,6 @@ int main(int argc, char* argv[])
|
|||
case 'k': settings = high_performance_seed(); --i; break;
|
||||
case 'j': settings.use_disk_read_ahead = false; --i; break;
|
||||
case 'z': settings.disable_hash_checks = true; --i; break;
|
||||
case 'r':
|
||||
preferred_ratio = atoi(arg);
|
||||
if (preferred_ratio != 0 && preferred_ratio < 1.f) preferred_ratio = 1.f;
|
||||
break;
|
||||
case 'B': settings.peer_timeout = atoi(arg); break;
|
||||
case 'n': settings.announce_to_all_tiers = true; --i; break;
|
||||
case 'G': seed_mode = true; --i; break;
|
||||
|
@ -1384,7 +1374,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
h.set_max_connections(max_connections_per_torrent);
|
||||
h.set_max_uploads(-1);
|
||||
h.set_ratio(preferred_ratio);
|
||||
h.set_upload_limit(torrent_upload_limit);
|
||||
h.set_download_limit(torrent_download_limit);
|
||||
h.use_interface(outgoing_interface.c_str());
|
||||
|
@ -1437,7 +1426,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
h.set_max_connections(max_connections_per_torrent);
|
||||
h.set_max_uploads(-1);
|
||||
h.set_ratio(preferred_ratio);
|
||||
h.set_upload_limit(torrent_upload_limit);
|
||||
h.set_download_limit(torrent_download_limit);
|
||||
h.use_interface(outgoing_interface.c_str());
|
||||
|
@ -1445,7 +1433,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
// if it's a torrent file, open it as usual
|
||||
add_torrent(ses, files, non_files, i->c_str(), preferred_ratio
|
||||
add_torrent(ses, files, non_files, i->c_str()
|
||||
, allocation_mode, save_path, false
|
||||
, torrent_upload_limit, torrent_download_limit);
|
||||
}
|
||||
|
@ -2178,7 +2166,7 @@ int main(int argc, char* argv[])
|
|||
if (!monitor_dir.empty()
|
||||
&& next_dir_scan < time_now())
|
||||
{
|
||||
scan_dir(monitor_dir, ses, files, non_files, preferred_ratio
|
||||
scan_dir(monitor_dir, ses, files, non_files
|
||||
, allocation_mode, save_path, torrent_upload_limit
|
||||
, torrent_download_limit);
|
||||
next_dir_scan = time_now() + seconds(poll_interval);
|
||||
|
|
|
@ -266,6 +266,10 @@ namespace libtorrent
|
|||
// ================ start deprecation ============
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 0.16, feature will be removed
|
||||
TORRENT_DEPRECATED_PREFIX
|
||||
void set_ratio(float up_down_ratio) const TORRENT_DEPRECATED;
|
||||
|
||||
// deprecated in 0.16. use status() instead
|
||||
TORRENT_DEPRECATED_PREFIX
|
||||
bool is_seed() const TORRENT_DEPRECATED;
|
||||
|
@ -368,10 +372,6 @@ namespace libtorrent
|
|||
// manually connect a peer
|
||||
void connect_peer(tcp::endpoint const& adr, int source = 0) const;
|
||||
|
||||
// valid ratios are 0 (infinite ratio) or [ 1.0 , inf )
|
||||
// the ratio is uploaded / downloaded. less than 1 is not allowed
|
||||
void set_ratio(float up_down_ratio) const;
|
||||
|
||||
std::string save_path() const;
|
||||
|
||||
// -1 means unlimited unchokes
|
||||
|
|
|
@ -573,6 +573,16 @@ namespace libtorrent
|
|||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// ============ start deprecation ===============
|
||||
|
||||
void torrent_handle::set_ratio(float ratio) const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
TORRENT_ASSERT(ratio >= 0.f);
|
||||
if (ratio < 1.f && ratio > 0.f)
|
||||
ratio = 1.f;
|
||||
TORRENT_ASYNC_CALL1(set_ratio, ratio);
|
||||
}
|
||||
|
||||
bool torrent_handle::is_seed() const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
@ -844,16 +854,6 @@ namespace libtorrent
|
|||
TORRENT_ASYNC_CALL1(super_seeding, on);
|
||||
}
|
||||
|
||||
void torrent_handle::set_ratio(float ratio) const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
TORRENT_ASSERT(ratio >= 0.f);
|
||||
if (ratio < 1.f && ratio > 0.f)
|
||||
ratio = 1.f;
|
||||
TORRENT_ASYNC_CALL1(set_ratio, ratio);
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
void torrent_handle::resolve_countries(bool r)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue