*** empty log message ***
This commit is contained in:
@@ -342,6 +342,10 @@ namespace libtorrent
|
|||||||
peer* worst_peer = 0;
|
peer* worst_peer = 0;
|
||||||
size_type min_weight = std::numeric_limits<int>::min();
|
size_type min_weight = std::numeric_limits<int>::min();
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
int unchoked_counter = m_num_unchoked;
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: make this selection better
|
// TODO: make this selection better
|
||||||
|
|
||||||
for (std::vector<peer>::iterator i = m_peers.begin();
|
for (std::vector<peer>::iterator i = m_peers.begin();
|
||||||
@@ -351,6 +355,9 @@ namespace libtorrent
|
|||||||
|
|
||||||
if (c == 0) continue;
|
if (c == 0) continue;
|
||||||
if (c->is_choked()) continue;
|
if (c->is_choked()) continue;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
unchoked_counter--;
|
||||||
|
#endif
|
||||||
// if the peer isn't interested, just choke it
|
// if the peer isn't interested, just choke it
|
||||||
if (!c->is_peer_interested())
|
if (!c->is_peer_interested())
|
||||||
return &(*i);
|
return &(*i);
|
||||||
@@ -360,14 +367,15 @@ namespace libtorrent
|
|||||||
|
|
||||||
size_type weight = static_cast<int>(c->statistics().download_rate() * 10.f)
|
size_type weight = static_cast<int>(c->statistics().download_rate() * 10.f)
|
||||||
+ diff
|
+ diff
|
||||||
+ (c->has_peer_choked()?-10:10)*1024;
|
+ ((c->is_interesting() && c->has_peer_choked())?-10:10)*1024;
|
||||||
|
|
||||||
if (weight > min_weight) continue;
|
if (weight >= min_weight && worst_peer) continue;
|
||||||
|
|
||||||
min_weight = weight;
|
min_weight = weight;
|
||||||
worst_peer = &(*i);
|
worst_peer = &(*i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
assert(unchoked_counter == 0);
|
||||||
return worst_peer;
|
return worst_peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,6 +740,8 @@ namespace libtorrent
|
|||||||
|
|
||||||
if (m_torrent->m_uploads_quota.given < m_torrent->num_peers())
|
if (m_torrent->m_uploads_quota.given < m_torrent->num_peers())
|
||||||
{
|
{
|
||||||
|
assert(m_torrent->m_uploads_quota.given >= 0);
|
||||||
|
|
||||||
// make sure we don't have too many
|
// make sure we don't have too many
|
||||||
// unchoked peers
|
// unchoked peers
|
||||||
while (m_num_unchoked > m_torrent->m_uploads_quota.given)
|
while (m_num_unchoked > m_torrent->m_uploads_quota.given)
|
||||||
|
Reference in New Issue
Block a user