made the handshake timeout configurable and defaults to 10 seconds
This commit is contained in:
parent
2662c84f01
commit
f054ae7c2d
|
@ -111,6 +111,7 @@ namespace libtorrent
|
||||||
, initial_picker_threshold(4)
|
, initial_picker_threshold(4)
|
||||||
, allowed_fast_set_size(10)
|
, allowed_fast_set_size(10)
|
||||||
, max_outstanding_disk_bytes_per_connection(64 * 1024)
|
, max_outstanding_disk_bytes_per_connection(64 * 1024)
|
||||||
|
, handshake_timeout(10)
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
, use_dht_as_fallback(true)
|
, use_dht_as_fallback(true)
|
||||||
#endif
|
#endif
|
||||||
|
@ -270,6 +271,11 @@ namespace libtorrent
|
||||||
// to not completely disrupt normal downloads.
|
// to not completely disrupt normal downloads.
|
||||||
int max_outstanding_disk_bytes_per_connection;
|
int max_outstanding_disk_bytes_per_connection;
|
||||||
|
|
||||||
|
// the number of seconds to wait for a handshake
|
||||||
|
// response from a peer. If no response is received
|
||||||
|
// within this time, the peer is disconnected.
|
||||||
|
int handshake_timeout;
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
// while this is true, the dht will note be used unless the
|
// while this is true, the dht will note be used unless the
|
||||||
// tracker is online
|
// tracker is online
|
||||||
|
|
|
@ -3000,13 +3000,12 @@ namespace libtorrent
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it takes more than 5 seconds to receive
|
// do not stall waiting for a handshake
|
||||||
// handshake, disconnect
|
if (in_handshake() && d > seconds(m_ses.settings().handshake_timeout))
|
||||||
if (in_handshake() && d > seconds(5))
|
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_VERBOSE_LOGGING
|
#ifdef TORRENT_VERBOSE_LOGGING
|
||||||
(*m_logger) << time_now_string() << " *** NO HANDSHAKE [ "
|
(*m_logger) << time_now_string() << " *** NO HANDSHAKE [ waited "
|
||||||
<< total_seconds(d) << " seconds ago ] ***\n";
|
<< total_seconds(d) << " seconds ] ***\n";
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue