torrent.go | 3 +++ diff --git a/torrent.go b/torrent.go index 99b71ae4f3d585cbd8033a7a7833dad4a7a145f2..9b3ff31e82aea1cdf01770b617045998d39aabfd 100644 --- a/torrent.go +++ b/torrent.go @@ -249,6 +249,9 @@ func (t *Torrent) addPeer(p Peer) { cl := t.cl peersAddedBySource.Add(string(p.Source), 1) + if t.closed.IsSet() { + return + } if cl.badPeerIPPort(p.IP, p.Port) { torrent.Add("peers not added because of bad addr", 1) return