From 96b92552b9cba59507baaf9696b0bd44dd04c856 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 4 Oct 2013 15:05:31 +0100 Subject: [PATCH] Can't use Connected() in Disconnect since it just set disconnected. Use p.connected directly. This restores the correct disconnection of peers when we go over the limit. Found by dhill, fix by me. --- peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peer.go b/peer.go index 0fa5573b..3fb600f0 100644 --- a/peer.go +++ b/peer.go @@ -1065,7 +1065,7 @@ func (p *peer) Disconnect() { return } close(p.quit) - if p.Connected() { + if atomic.LoadInt32(&p.connected) != 0 { p.conn.Close() } }