merged RC_1_1 into master
This commit is contained in:
commit
d45de18ba7
|
@ -82,6 +82,7 @@
|
|||
* resume data no longer has timestamps of files
|
||||
* require C++11 to build libtorrent
|
||||
|
||||
* make torrent_handler::set_priority() to use peer_classes
|
||||
* fix support for boost-1.66 (requires C++11)
|
||||
* fix i2p support
|
||||
* fix loading resume data when in seed mode
|
||||
|
|
|
@ -601,6 +601,11 @@ namespace libtorrent {
|
|||
void connect_to_url_seed(std::list<web_seed_t>::iterator url);
|
||||
bool connect_to_peer(torrent_peer* peerinfo, bool ignore_limit = false);
|
||||
|
||||
int priority() const;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void set_priority(int const prio);
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
// --------------------------------------------
|
||||
// BANDWIDTH MANAGEMENT
|
||||
|
||||
|
@ -1590,6 +1595,8 @@ namespace libtorrent {
|
|||
// the number of bytes of padding files
|
||||
std::uint32_t m_padding:24;
|
||||
|
||||
// TODO: 8 bits available here
|
||||
|
||||
// ----
|
||||
|
||||
// the scrape data from the tracker response, this
|
||||
|
|
|
@ -10621,16 +10621,7 @@ namespace {
|
|||
st->up_bandwidth_queue = 0;
|
||||
st->down_bandwidth_queue = 0;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
int priority = 0;
|
||||
for (int i = 0; i < num_classes(); ++i)
|
||||
{
|
||||
int const* prio = m_ses.peer_classes().at(class_at(i))->priority;
|
||||
if (priority < prio[peer_connection::upload_channel])
|
||||
priority = prio[peer_connection::upload_channel];
|
||||
if (priority < prio[peer_connection::download_channel])
|
||||
priority = prio[peer_connection::download_channel];
|
||||
}
|
||||
st->priority = priority;
|
||||
st->priority = priority();
|
||||
#endif
|
||||
|
||||
st->num_peers = num_peers() - m_num_connecting;
|
||||
|
@ -10835,6 +10826,36 @@ namespace {
|
|||
st->last_seen_complete = m_swarm_last_seen_complete;
|
||||
}
|
||||
|
||||
int torrent::priority() const
|
||||
{
|
||||
int priority = 0;
|
||||
for (int i = 0; i < num_classes(); ++i)
|
||||
{
|
||||
int const* prio = m_ses.peer_classes().at(class_at(i))->priority;
|
||||
priority = std::max(priority, prio[peer_connection::upload_channel]);
|
||||
priority = std::max(priority, prio[peer_connection::download_channel]);
|
||||
}
|
||||
return priority;
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void torrent::set_priority(int const prio)
|
||||
{
|
||||
// priority 1 is default
|
||||
if (prio == 1 && m_peer_class == 0) return;
|
||||
|
||||
if (m_peer_class == 0)
|
||||
setup_peer_class();
|
||||
|
||||
struct peer_class* tpc = m_ses.peer_classes().at(m_peer_class);
|
||||
TORRENT_ASSERT(tpc);
|
||||
tpc->priority[peer_connection::download_channel] = prio;
|
||||
tpc->priority[peer_connection::upload_channel] = prio;
|
||||
|
||||
state_updated();
|
||||
}
|
||||
#endif
|
||||
|
||||
void torrent::add_redundant_bytes(int const b, waste_reason const reason)
|
||||
{
|
||||
TORRENT_ASSERT(is_single_thread());
|
||||
|
|
|
@ -425,7 +425,10 @@ namespace libtorrent {
|
|||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void torrent_handle::set_priority(int) const {}
|
||||
void torrent_handle::set_priority(int const p) const
|
||||
{
|
||||
async_call(&torrent::set_priority, p);
|
||||
}
|
||||
|
||||
void torrent_handle::set_tracker_login(std::string const& name
|
||||
, std::string const& password) const
|
||||
|
|
Loading…
Reference in New Issue