Fix deadlock in Client.onDHTAnnouncePeer

This commit is contained in:
Matt Joiner 2016-11-27 14:43:21 +11:00
parent f451a39b69
commit 8b50f5fa7a
1 changed files with 2 additions and 2 deletions

View File

@ -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{{