fix lt bugs 145 and 122
This commit is contained in:
parent
2214834d2b
commit
c746457629
@ -948,7 +948,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");
|
||||
}
|
||||
|
||||
@ -516,6 +516,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();
|
||||
|
||||
@ -524,7 +525,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;
|
||||
@ -1179,7 +1180,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);
|
||||
}
|
||||
|
||||
@ -785,9 +785,30 @@ namespace detail
|
||||
}
|
||||
return;
|
||||
}
|
||||
// check if we have any active torrents
|
||||
// if we don't reject the connection
|
||||
if (m_torrents.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool has_active_torrent = false;
|
||||
for (torrent_map::iterator i = m_torrents.begin()
|
||||
, end(m_torrents.end()); i != end; ++i)
|
||||
{
|
||||
if (!i->second->is_paused())
|
||||
{
|
||||
has_active_torrent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has_active_torrent)
|
||||
return;
|
||||
}
|
||||
|
||||
boost::intrusive_ptr<peer_connection> c(
|
||||
new bt_peer_connection(*this, s, 0));
|
||||
new bt_peer_connection(*this, s, 0));
|
||||
#ifndef NDEBUG
|
||||
c->m_in_constructor = false;
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user