From 8b50f5fa7abf587f4d047e7f5e4426df1f568902 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 27 Nov 2016 14:43:21 +1100 Subject: [PATCH] Fix deadlock in Client.onDHTAnnouncePeer --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 5dfb465e..b12dbf69 100644 --- a/client.go +++ b/client.go @@ -1358,8 +1358,8 @@ func (cl *Client) newConnection(nc net.Conn) (c *connection) { func (cl *Client) onDHTAnnouncePeer(ih metainfo.Hash, p dht.Peer) { cl.mu.Lock() defer cl.mu.Unlock() - t, ok := cl.Torrent(ih) - if !ok { + t := cl.torrent(ih) + if t == nil { return } t.addPeers([]Peer{{