add default peer rate limit setting
This commit is contained in:
parent
2ec1c81cd3
commit
fb06acc828
|
@ -3783,6 +3783,9 @@ session_settings
|
|||
bool incoming_starts_queued_torrents;
|
||||
bool report_true_downloaded;
|
||||
bool strict_end_game_mode;
|
||||
|
||||
int default_peer_upload_rate;
|
||||
int default_peer_download_rate;
|
||||
};
|
||||
|
||||
``user_agent`` this is the client identification to the tracker.
|
||||
|
@ -4379,6 +4382,13 @@ If this is ``false``, libtorrent attempts to use each peer connection
|
|||
to its max, by always requesting something, even if it means requesting
|
||||
something that has been requested from another peer already.
|
||||
|
||||
``default_peer_upload_rate`` and ``default_peer_download_rate`` specifies
|
||||
the default upload and download rate limits for peers, respectively. These
|
||||
default to 0, which means unlimited. These settings affect the rate limits
|
||||
set on new peer connections (not existing ones). The peer rate limits can
|
||||
be changed individually later using
|
||||
`set_peer_upload_limit() set_peer_download_limit()`_.
|
||||
|
||||
pe_settings
|
||||
===========
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ namespace libtorrent
|
|||
, incoming_starts_queued_torrents(false)
|
||||
, report_true_downloaded(false)
|
||||
, strict_end_game_mode(true)
|
||||
, default_peer_upload_rate(0)
|
||||
, default_peer_download_rate(0)
|
||||
{}
|
||||
|
||||
// this is the user agent that will be sent to the tracker
|
||||
|
@ -774,6 +776,10 @@ namespace libtorrent
|
|||
// if set to true, libtorrent won't request a piece multiple times
|
||||
// until every piece is requested
|
||||
bool strict_end_game_mode;
|
||||
|
||||
// each peer will have these limits set on it
|
||||
int default_peer_upload_rate;
|
||||
int default_peer_download_rate;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -301,6 +301,8 @@ namespace aux {
|
|||
TORRENT_SETTING(boolean, incoming_starts_queued_torrents)
|
||||
TORRENT_SETTING(boolean, report_true_downloaded)
|
||||
TORRENT_SETTING(boolean, strict_end_game_mode)
|
||||
TORRENT_SETTING(integer, default_peer_upload_rate)
|
||||
TORRENT_SETTING(integer, default_peer_download_rate)
|
||||
};
|
||||
|
||||
#undef TORRENT_SETTING
|
||||
|
@ -1610,6 +1612,10 @@ namespace aux {
|
|||
{
|
||||
m_connections.insert(c);
|
||||
c->start();
|
||||
if (m_settings.default_peer_upload_rate)
|
||||
c->set_upload_limit(m_settings.default_peer_upload_rate);
|
||||
if (m_settings.default_peer_download_rate)
|
||||
c->set_download_limit(m_settings.default_peer_download_rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4136,6 +4136,11 @@ namespace libtorrent
|
|||
c->m_in_constructor = false;
|
||||
#endif
|
||||
|
||||
if (settings().default_peer_upload_rate)
|
||||
c->set_upload_limit(settings().default_peer_upload_rate);
|
||||
if (settings().default_peer_download_rate)
|
||||
c->set_download_limit(settings().default_peer_download_rate);
|
||||
|
||||
c->add_stat(peerinfo->prev_amount_download, peerinfo->prev_amount_upload);
|
||||
peerinfo->prev_amount_download = 0;
|
||||
peerinfo->prev_amount_upload = 0;
|
||||
|
|
Loading…
Reference in New Issue