Handle case where a torrent is deleted before being processed

This commit is contained in:
Justin Li 2014-07-16 20:06:45 -04:00
parent 019bb449b5
commit 0f2ed791e5

View file

@ -246,6 +246,10 @@ func (c *Conn) PurgeInactivePeers(purgeEmptyTorrents bool, before time.Time) err
c.torrentsM.Lock()
torrent := c.torrents[infohash]
if torrent == nil {
continue // Torrent deleted since keys were computed.
}
for key, peer := range torrent.Seeders {
if peer.LastAnnounce < unixtime {
delete(torrent.Seeders, key)