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