From 0f2ed791e57c117ffb7e6916337a031973364d26 Mon Sep 17 00:00:00 2001 From: Justin Li Date: Wed, 16 Jul 2014 20:06:45 -0400 Subject: [PATCH] Handle case where a torrent is deleted before being processed --- drivers/tracker/memory/conn.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tracker/memory/conn.go b/drivers/tracker/memory/conn.go index 6a3f3a0..957164c 100644 --- a/drivers/tracker/memory/conn.go +++ b/drivers/tracker/memory/conn.go @@ -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)