added a shorter timeout while waiting for a hanshake response from peers

This commit is contained in:
Arvid Norberg 2007-09-17 02:29:33 +00:00
parent 1502080542
commit 33add5bb91
1 changed files with 4 additions and 5 deletions

View File

@ -2915,11 +2915,6 @@ namespace libtorrent
// TODO: the timeout should be called by an event
INVARIANT_CHECK;
#ifndef NDEBUG
// allow step debugging without timing out
return false;
#endif
ptime now(time_now());
// if the socket is still connecting, don't
@ -2933,6 +2928,10 @@ namespace libtorrent
d = now - m_last_receive;
if (d > seconds(m_timeout)) return true;
// if it takes more than 5 seconds to receive
// handshake, disconnect
if (in_handshake() && d > seconds(5)) return true;
// disconnect peers that we unchoked, but
// they didn't send a request within 20 seconds.
// but only if we're a seed