From cb1fce0d625686af859be79cd680e9e642601989 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 14 Oct 2008 01:00:05 +0000 Subject: [PATCH] fix to immediately unchoke another peer if an unchoked peer is disconnected --- src/torrent.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/torrent.cpp b/src/torrent.cpp index 8639e967f..caadd1521 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2092,7 +2092,15 @@ namespace libtorrent } if (!p->is_choked()) + { --m_num_uploads; + m_ses.m_unchoke_time_scaler = 0; + } + + if (p->peer_info_struct() && p->peer_info_struct()->optimistically_unchoked) + { + m_ses.m_optimistic_unchoke_time_scaler = 0; + } m_policy.connection_closed(*p); p->set_peer_info(0);