fixed so that peers only get one fast-reconnect

This commit is contained in:
Arvid Norberg 2007-10-12 01:12:30 +00:00
parent 64056a667f
commit c6c77d8efc
3 changed files with 10 additions and 1 deletions

View File

@ -176,7 +176,13 @@ namespace libtorrent
void set_non_prioritized(bool b) void set_non_prioritized(bool b)
{ m_non_prioritized = b; } { m_non_prioritized = b; }
void fast_reconnect(bool r) { m_fast_reconnect = r; } void fast_reconnect(bool r)
{
if (peer_info_struct() && peer_info_struct()->fast_reconnects > 0) return;
m_fast_reconnect = r;
if (peer_info_struct()) ++peer_info_struct()->fast_reconnects;
}
bool fast_reconnect() const { return m_fast_reconnect; } bool fast_reconnect() const { return m_fast_reconnect; }
// this adds an announcement in the announcement queue // this adds an announcement in the announcement queue

View File

@ -156,6 +156,8 @@ namespace libtorrent
// this is true if the peer is a seed // this is true if the peer is a seed
bool seed; bool seed;
int fast_reconnects;
// true if this peer currently is unchoked // true if this peer currently is unchoked
// because of an optimistic unchoke. // because of an optimistic unchoke.
// when the optimistic unchoke is moved to // when the optimistic unchoke is moved to

View File

@ -1503,6 +1503,7 @@ namespace libtorrent
, failcount(0) , failcount(0)
, hashfails(0) , hashfails(0)
, seed(false) , seed(false)
, fast_reconnects(0)
, optimistically_unchoked(false) , optimistically_unchoked(false)
, last_optimistically_unchoked(min_time()) , last_optimistically_unchoked(min_time())
, connected(min_time()) , connected(min_time())