timeout incoming connections

This commit is contained in:
Arvid Norberg 2008-07-10 10:35:11 +00:00
parent d51bdc0ec0
commit d2c53b50d5
1 changed files with 17 additions and 0 deletions

View File

@ -1022,6 +1022,23 @@ namespace aux {
<< m_disk_thread.disk_allocations() << "\t" << m_disk_thread.disk_allocations() << "\t"
<< std::endl; << std::endl;
#endif #endif
// --------------------------------------------------------------
// check for incoming connections that might have timed out
// --------------------------------------------------------------
for (connection_map::iterator i = m_connections.begin();
i != m_connections.end();)
{
peer_connection* p = (*i).get();
++i;
// ignore connections that already have a torrent, since they
// are ticket through the torrents' second_ticket
if (!p->associated_torrent().expired()) continue;
if (m_last_tick - p->connected_time() > seconds(m_settings.peer_connect_timeout))
p->disconnect("timeout: incoming connection");
}
// -------------------------------------------------------------- // --------------------------------------------------------------
// second_tick every torrent // second_tick every torrent
// -------------------------------------------------------------- // --------------------------------------------------------------