This commit is contained in:
Arvid Norberg 2007-09-03 22:57:09 +00:00
parent 4e8d49d028
commit d2706b3600
2 changed files with 9 additions and 8 deletions

View File

@ -343,7 +343,7 @@ namespace libtorrent
// if this is a web seed. we don't have a peer_info struct
if (m_peer_info) m_peer_info->seed = true;
// if we're a seed too, disconnect
if (t->is_seed())
if (t->is_finished())
{
throw std::runtime_error("seed to seed connection redundant, disconnecting");
}
@ -917,7 +917,7 @@ namespace libtorrent
{
assert(m_peer_info);
m_peer_info->seed = true;
if (t->is_seed())
if (t->is_finished())
{
throw protocol_error("seed to seed connection redundant, disconnecting");
}
@ -988,7 +988,7 @@ namespace libtorrent
// if this is a web seed. we don't have a peer_info struct
if (m_peer_info) m_peer_info->seed = true;
// if we're a seed too, disconnect
if (t->is_seed())
if (t->is_finished())
{
throw protocol_error("seed to seed connection redundant, disconnecting");
}
@ -1517,7 +1517,7 @@ namespace libtorrent
#endif
// if we're a seed too, disconnect
if (t->is_seed())
if (t->is_finished())
throw protocol_error("seed to seed connection redundant, disconnecting");
assert(!m_have_piece.empty());
@ -2186,7 +2186,7 @@ namespace libtorrent
// maintain the share ratio given by m_ratio
// with all peers.
if (t->is_seed() || is_choked() || t->ratio() == 0.0f)
if (t->is_finished() || is_choked() || t->ratio() == 0.0f)
{
// if we have downloaded more than one piece more
// than we have uploaded OR if we are a seed
@ -2922,7 +2922,7 @@ namespace libtorrent
if (m_requests.empty()
&& !m_choked
&& m_peer_interested
&& t && t->is_seed()
&& t && t->is_finished()
&& d > seconds(20)) return true;
// TODO: as long as we have less than 95% of the

View File

@ -528,6 +528,7 @@ namespace libtorrent
int max_failcount = m_torrent->settings().max_failcount;
int min_reconnect_time = m_torrent->settings().min_reconnect_time;
bool finished = m_torrent->is_finished();
aux::session_impl& ses = m_torrent->session();
@ -536,7 +537,7 @@ namespace libtorrent
if (i->connection) continue;
if (i->banned) continue;
if (i->type == peer::not_connectable) continue;
if (i->seed && m_torrent->is_seed()) continue;
if (i->seed && finished) continue;
if (i->failcount >= max_failcount) continue;
if (now - i->connected < seconds(i->failcount * min_reconnect_time))
continue;
@ -1191,7 +1192,7 @@ namespace libtorrent
&& m_torrent->session().num_uploads() < m_torrent->session().max_uploads()
&& (m_torrent->ratio() == 0
|| c.share_diff() >= -free_upload_amount
|| m_torrent->is_seed()))
|| m_torrent->is_finished()))
{
m_torrent->session().unchoke_peer(c);
}