mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
lt sync 2802
This commit is contained in:
parent
f1a81d9863
commit
fd4e548938
4 changed files with 26 additions and 16 deletions
|
@ -87,6 +87,14 @@ namespace libtorrent
|
|||
|
||||
size_type counter() const { return m_counter; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::memset(m_rate_history, 0, sizeof(m_rate_history));
|
||||
m_counter = 0;
|
||||
m_total_counter = 0;
|
||||
m_rate_sum = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -218,6 +226,12 @@ namespace libtorrent
|
|||
size_type last_payload_uploaded() const
|
||||
{ return m_stat[upload_payload].counter(); }
|
||||
|
||||
void clear()
|
||||
{
|
||||
for (int i = 0; i < num_channels; ++i)
|
||||
m_stat[i].clear();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// these are the channels we keep stats for
|
||||
|
|
|
@ -282,9 +282,12 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(p);
|
||||
peer_connection const& rhs = *p;
|
||||
|
||||
size_type c1;
|
||||
size_type c2;
|
||||
|
||||
// first compare how many bytes they've sent us
|
||||
size_type c1 = m_statistics.total_payload_download() - m_downloaded_at_last_unchoke;
|
||||
size_type c2 = rhs.m_statistics.total_payload_download() - rhs.m_downloaded_at_last_unchoke;
|
||||
c1 = m_statistics.total_payload_download() - m_downloaded_at_last_unchoke;
|
||||
c2 = rhs.m_statistics.total_payload_download() - rhs.m_downloaded_at_last_unchoke;
|
||||
if (c1 > c2) return true;
|
||||
if (c1 < c2) return false;
|
||||
|
||||
|
@ -297,10 +300,12 @@ namespace libtorrent
|
|||
// in order to not switch back and forth too often,
|
||||
// unchoked peers must be at least one piece ahead
|
||||
// of a choked peer to be sorted at a lower unchoke-priority
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
TORRENT_ASSERT(t);
|
||||
if (!is_choked()) c1 -= t->torrent_file().piece_length();
|
||||
if (!rhs.is_choked()) c2 -= t->torrent_file().piece_length();
|
||||
boost::shared_ptr<torrent> t1 = m_torrent.lock();
|
||||
TORRENT_ASSERT(t1);
|
||||
boost::shared_ptr<torrent> t2 = rhs.associated_torrent().lock();
|
||||
TORRENT_ASSERT(t2);
|
||||
if (!is_choked()) c1 -= t1->torrent_file().piece_length();
|
||||
if (!rhs.is_choked()) c2 -= t2->torrent_file().piece_length();
|
||||
|
||||
return c1 < c2;
|
||||
}
|
||||
|
|
|
@ -931,16 +931,6 @@ namespace libtorrent
|
|||
c.add_free_upload(-diff);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (!c.is_choked())
|
||||
{
|
||||
c.send_choke();
|
||||
--m_num_unchoked;
|
||||
|
||||
if (m_torrent->is_seed()) seed_unchoke_one_peer();
|
||||
else unchoke_one_peer();
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
bool policy::unchoke_one_peer()
|
||||
|
|
|
@ -4042,6 +4042,7 @@ namespace libtorrent
|
|||
{
|
||||
// tell the tracker that we're back
|
||||
m_start_sent = false;
|
||||
m_stat.clear();
|
||||
announce_with_tracker();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue