diff --git a/libtorrent/include/libtorrent/peer_connection.hpp b/libtorrent/include/libtorrent/peer_connection.hpp index 2ea3c7d34..c682388e3 100755 --- a/libtorrent/include/libtorrent/peer_connection.hpp +++ b/libtorrent/include/libtorrent/peer_connection.hpp @@ -176,7 +176,13 @@ namespace libtorrent void set_non_prioritized(bool 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; } // this adds an announcement in the announcement queue diff --git a/libtorrent/include/libtorrent/policy.hpp b/libtorrent/include/libtorrent/policy.hpp index 551cb4f2c..c38bb426c 100755 --- a/libtorrent/include/libtorrent/policy.hpp +++ b/libtorrent/include/libtorrent/policy.hpp @@ -156,6 +156,8 @@ namespace libtorrent // this is true if the peer is a seed bool seed; + int fast_reconnects; + // true if this peer currently is unchoked // because of an optimistic unchoke. // when the optimistic unchoke is moved to diff --git a/libtorrent/src/policy.cpp b/libtorrent/src/policy.cpp index c337d2456..cc11b80e3 100755 --- a/libtorrent/src/policy.cpp +++ b/libtorrent/src/policy.cpp @@ -1503,6 +1503,7 @@ namespace libtorrent , failcount(0) , hashfails(0) , seed(false) + , fast_reconnects(0) , optimistically_unchoked(false) , last_optimistically_unchoked(min_time()) , connected(min_time())