client.go | 2 +- diff --git a/client.go b/client.go index 4a42b17c759af9884d634ec3ac0e8ab400801e4d..9463a8e1f570c156ee14b5663d2a227b7c2124b8 100644 --- a/client.go +++ b/client.go @@ -816,13 +816,13 @@ // 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 }