mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-14 08:33:36 -07:00
Handle case where a torrent is deleted before being processed
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user