From: Matt Joiner Date: Sun, 27 Nov 2016 03:43:21 +0000 (+1100) Subject: Fix deadlock in Client.onDHTAnnouncePeer X-Git-Tag: v1.0.0~521 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8b50f5fa7abf587f4d047e7f5e4426df1f568902;p=btrtrc.git Fix deadlock in Client.onDHTAnnouncePeer --- 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{{