From e1d6b49b2d9cd88246f751c03f6df0678ebba3db Mon Sep 17 00:00:00 2001 From: vyzo Date: Tue, 14 Apr 2020 10:16:40 +0300 Subject: [PATCH] fix bug in peerScore.setIPs It was removing all old addresses, not just the ones in the new addres slice --- score.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/score.go b/score.go index f373181..3af67a6 100644 --- a/score.go +++ b/score.go @@ -818,15 +818,15 @@ removeOldIPs: if ip == xip { continue removeOldIPs } - // no, it's obsolete -- remove it from the tracker - peers, ok := ps.peerIPs[ip] - if !ok { - continue - } - delete(peers, p) - if len(peers) == 0 { - delete(ps.peerIPs, ip) - } + } + // no, it's obsolete -- remove it from the tracker + peers, ok := ps.peerIPs[ip] + if !ok { + continue + } + delete(peers, p) + if len(peers) == 0 { + delete(ps.peerIPs, ip) } } }