From c6ec935e534a7a1f1232f870e412ca1af363d501 Mon Sep 17 00:00:00 2001
From: Matt Joiner <anacrolix@gmail.com>
Date: Mon, 23 May 2016 10:19:14 +1000
Subject: [PATCH] Update Torrent.wantPeersEvent in several places

---
 client.go  | 1 +
 torrent.go | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/client.go b/client.go
index 2b6c4da9..a6dd9c98 100644
--- a/client.go
+++ b/client.go
@@ -1508,6 +1508,7 @@ func (cl *Client) AddTorrentInfoHash(infoHash metainfo.Hash) (t *Torrent, new bo
 		go cl.announceTorrentDHT(t, true)
 	}
 	cl.torrents[infoHash] = t
+	t.updateWantPeersEvent()
 	return
 }
 
diff --git a/torrent.go b/torrent.go
index 1b584807..e13accf5 100644
--- a/torrent.go
+++ b/torrent.go
@@ -519,6 +519,7 @@ func (t *Torrent) close() (err error) {
 		conn.Close()
 	}
 	t.pieceStateChanges.Close()
+	t.updateWantPeersEvent()
 	return
 }
 
@@ -1076,6 +1077,7 @@ func (t *Torrent) addTrackers(announceList [][]string) {
 		(*fullAnnounceList)[tierIndex] = appendMissingStrings((*fullAnnounceList)[tierIndex], trackerURLs)
 	}
 	t.startMissingTrackerScrapers()
+	t.updateWantPeersEvent()
 }
 
 // Don't call this before the info is available.
-- 
2.51.0