From 6d529185406d5e4aae8e603cefc080e73323f03a Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 23 Jul 2014 01:51:30 +1000 Subject: [PATCH] Fix missed unlock adding peers to non-existent torrent --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index 4a42b17c..9463a8e1 100644 --- a/client.go +++ b/client.go @@ -816,13 +816,13 @@ func (me *Client) openNewConns() { // Adds peers to the swarm for the torrent corresponding to infoHash. func (me *Client) AddPeers(infoHash InfoHash, peers []Peer) error { me.mu.Lock() + defer me.mu.Unlock() t := me.torrent(infoHash) if t == nil { return errors.New("no such torrent") } t.Peers = append(t.Peers, peers...) me.openNewConns() - me.mu.Unlock() return nil } -- 2.48.1