Quadruple handshake timeout for i2p

This commit is contained in:
Mikhail Titov 2015-06-17 00:18:38 -05:00
parent 9fc4968dc4
commit 77ca1ac16f
2 changed files with 10 additions and 3 deletions

View File

@ -4706,10 +4706,14 @@ namespace libtorrent
}
// do not stall waiting for a handshake
int timeout = m_settings.get_int (settings_pack::handshake_timeout);
#if TORRENT_USE_I2P
timeout *= is_i2p(*m_socket) ? 4 : 1;
#endif
if (may_timeout
&& !m_connecting
&& in_handshake()
&& d > seconds(m_settings.get_int(settings_pack::handshake_timeout)))
&& d > seconds(timeout))
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "NO_HANDSHAKE", "waited %d seconds"

View File

@ -3042,8 +3042,11 @@ retry:
if (!p->associated_torrent().expired()) continue;
// TODO: have a separate list for these connections, instead of having to loop through all of them
if (m_last_tick - p->connected_time()
> seconds(m_settings.get_int(settings_pack::handshake_timeout)))
int timeout = m_settings.get_int(settings_pack::handshake_timeout);
#if TORRENT_USE_I2P
timeout *= is_i2p(*p->get_socket()) ? 4 : 1;
#endif
if (m_last_tick - p->connected_time () > seconds(timeout))
p->disconnect(errors::timed_out, op_bittorrent);
}