Simpler, more efficient way of deleting inactive torrents

This commit is contained in:
Justin Li
2014-07-16 15:03:33 -04:00
parent e29fb21edb
commit 7fe6dc3b4e
5 changed files with 21 additions and 80 deletions
+4
View File
@@ -91,6 +91,10 @@ func (t *Tracker) ServeAnnounce(w http.ResponseWriter, r *http.Request, p httpro
if err != nil {
return http.StatusInternalServerError, err
}
} else if torrent.PeerCount() == 0 {
// Rather than deleting the torrent explicitly, let the tracker driver
// ensure there are no race conditions.
conn.PurgeInactiveTorrent(torrent.Infohash)
}
resp := newAnnounceResponse(ann, user, torrent)
-5
View File
@@ -31,11 +31,6 @@ func NewTracker(cfg *config.Config) (*Tracker, error) {
return nil, err
}
err = tracker.StartPurgingRoutines(tp, &cfg.Tracker)
if err != nil {
return nil, err
}
bc, err := backend.Open(&cfg.Backend)
if err != nil {
return nil, err