don't reject peer connections just because the peerlist is full

This commit is contained in:
Arvid Norberg 2011-05-01 18:37:49 +00:00
parent a9cc2101c6
commit 83ba5afaa5
2 changed files with 12 additions and 2 deletions

View File

@ -847,8 +847,12 @@ namespace libtorrent
if (int(m_peers.size()) >= m_torrent->settings().max_peerlist_size)
{
c.disconnect(errors::too_many_connections);
return false;
erase_peers();
if (int(m_peers.size()) >= m_torrent->settings().max_peerlist_size)
{
c.disconnect(errors::too_many_connections);
return false;
}
}
#if TORRENT_USE_IPV6

View File

@ -5173,7 +5173,13 @@ namespace libtorrent
}
#endif
if (!m_policy.new_connection(*p, m_ses.session_time()))
{
#if defined TORRENT_LOGGING
(*m_ses.m_logger) << time_now_string() << " CLOSING CONNECTION "
<< p->remote() << " policy::new_connection returned false (i.e. peer list full)\n";
#endif
return false;
}
}
TORRENT_CATCH (std::exception& e)
{