mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-10 22:29:08 -07:00
Add peer purging test, and ensure the purging routine runs whenever a tracker is created
This commit is contained in:
14
http/http.go
14
http/http.go
@@ -36,6 +36,13 @@ func NewTracker(cfg *config.Config) (*Tracker, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go tracker.PurgeInactivePeers(
|
||||
tp,
|
||||
cfg.PurgeInactiveTorrents,
|
||||
cfg.Announce.Duration*2,
|
||||
cfg.Announce.Duration,
|
||||
)
|
||||
|
||||
return &Tracker{
|
||||
cfg: cfg,
|
||||
pool: tp,
|
||||
@@ -99,13 +106,6 @@ func Serve(cfg *config.Config) {
|
||||
glog.Fatal("New: ", err)
|
||||
}
|
||||
|
||||
go tracker.PurgeInactivePeers(
|
||||
t.pool,
|
||||
cfg.PurgeInactiveTorrents,
|
||||
cfg.Announce.Duration*2,
|
||||
cfg.Announce.Duration,
|
||||
)
|
||||
|
||||
glog.V(0).Info("Starting on ", cfg.Addr)
|
||||
graceful.Run(cfg.Addr, cfg.RequestTimeout.Duration, NewRouter(t, cfg))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user