From: Matt Joiner Date: Tue, 22 Jul 2014 15:51:30 +0000 (+1000) Subject: Fix missed unlock adding peers to non-existent torrent X-Git-Tag: v1.0.0~1649 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=6d529185406d5e4aae8e603cefc080e73323f03a;p=btrtrc.git Fix missed unlock adding peers to non-existent torrent --- 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 }