From a6eda97281956da6fc1873e22a26bec58bff94b1 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 22 Sep 2014 07:34:10 +0000 Subject: [PATCH] fix optimistic unchoke stats gauge --- src/policy.cpp | 3 ++- src/torrent.cpp | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/policy.cpp b/src/policy.cpp index 28ddd24cd..8eb91dd5f 100644 --- a/src/policy.cpp +++ b/src/policy.cpp @@ -1150,7 +1150,8 @@ namespace libtorrent } // this is called whenever a peer connection is closed - void policy::connection_closed(const peer_connection_interface& c, int session_time, torrent_state* state) + void policy::connection_closed(const peer_connection_interface& c + , int session_time, torrent_state* state) { TORRENT_ASSERT(is_single_thread()); INVARIANT_CHECK; diff --git a/src/torrent.cpp b/src/torrent.cpp index e88d42cc0..a898829f8 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -5782,7 +5782,12 @@ namespace libtorrent if (pp) { if (pp->optimistically_unchoked) + { + pp->optimistically_unchoked = false; + m_stats_counters.inc_stats_counter( + counters::num_peers_up_unchoked_optimistic, -1); trigger_optimistic_unchoke(); + } TORRENT_ASSERT(pp->prev_amount_upload == 0); TORRENT_ASSERT(pp->prev_amount_download == 0);