Handle case where a torrent is deleted before being processed
This commit is contained in:
parent
019bb449b5
commit
0f2ed791e5
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue