*** empty log message ***

This commit is contained in:
Magnus Jonsson 2004-01-14 12:19:51 +00:00
parent 5068562916
commit bbf58b64e5
2 changed files with 12 additions and 6 deletions

View File

@ -1143,9 +1143,9 @@ namespace libtorrent
int diff = share_diff();
enum { blockLimit=2 }; // how many blocks difference is considered unfair
enum { block_limit=2 }; // how many blocks difference is considered unfair
if (diff > blockLimit*m_torrent->block_size() || m_torrent->is_seed())
if (diff > block_limit*m_torrent->block_size() || m_torrent->is_seed())
{
// if we have downloaded more than one piece more
// than we have uploaded OR if we are a seed
@ -1160,7 +1160,7 @@ namespace libtorrent
// if we have uploaded too much, send with a rate of
// 10 kB/s less than we receive
int bias = 0;
if (diff > -blockLimit*m_torrent->block_size())
if (diff > -block_limit*m_torrent->block_size())
{
bias = static_cast<int>(m_statistics.download_rate() * ratio) / 2;
if (bias < 10*1024) bias = 10*1024;

View File

@ -210,7 +210,7 @@ namespace
// (and we should consider it free). If the share diff is
// negative, there's no free download to get from this peer.
int diff = i->second->share_diff();
if (i->second->is_peer_interested() || diff <= 0)
if (i->second->is_peer_interested() || diff <= 0 || diff==std::numeric_limits<int>::max())
continue;
assert(diff > 0);
@ -233,10 +233,13 @@ namespace
if (free_upload <= 0) return free_upload;
int num_peers = 0;
int total_diff = 0;
for (torrent::peer_iterator i = start; i != end; ++i)
{
total_diff += i->second->share_diff();
if (!i->second->is_peer_interested() || i->second->share_diff() >= 0) continue;
int diff=i->second->share_diff();
if(diff==std::numeric_limits<int>::max()) continue;
total_diff += diff;
if (!i->second->is_peer_interested() || diff >= 0) continue;
++num_peers;
}
@ -305,6 +308,8 @@ namespace libtorrent
// int diff = i->total_download()
// - i->total_upload();
int diff = c->share_diff();
if(diff==std::numeric_limits<int>::max())
diff=0;
int weight = static_cast<int>(c->statistics().download_rate() * 10.f)
+ diff
@ -450,6 +455,7 @@ namespace libtorrent
if (c == 0) continue;
int diff=c->share_diff();
// no problem if diff returns std::numeric_limits<int>::max()
if (diff <= -free_upload_amount
&& !c->is_choked())