announce & scrape stats
This commit is contained in:
parent
477f292371
commit
24f3e6b80b
2 changed files with 9 additions and 1 deletions
|
@ -7,6 +7,7 @@ package tracker
|
|||
import (
|
||||
"net"
|
||||
|
||||
"github.com/chihaya/chihaya/stats"
|
||||
"github.com/chihaya/chihaya/tracker/models"
|
||||
)
|
||||
|
||||
|
@ -88,6 +89,8 @@ func (tkr *Tracker) HandleAnnounce(ann *models.Announce, w Writer) error {
|
|||
conn.PurgeInactiveTorrent(torrent.Infohash)
|
||||
}
|
||||
|
||||
stats.RecordEvent(stats.Announce)
|
||||
|
||||
return w.WriteAnnounce(newAnnounceResponse(ann, peer, torrent))
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
|
||||
package tracker
|
||||
|
||||
import "github.com/chihaya/chihaya/tracker/models"
|
||||
import (
|
||||
"github.com/chihaya/chihaya/stats"
|
||||
"github.com/chihaya/chihaya/tracker/models"
|
||||
)
|
||||
|
||||
// HandleScrape encapsulates all the logic of handling a BitTorrent client's
|
||||
// scrape without being coupled to any transport protocol.
|
||||
|
@ -38,5 +41,7 @@ func (tkr *Tracker) HandleScrape(scrape *models.Scrape, w Writer) (err error) {
|
|||
torrents = append(torrents, torrent)
|
||||
}
|
||||
|
||||
stats.RecordEvent(stats.Scrape)
|
||||
|
||||
return w.WriteScrape(&models.ScrapeResponse{torrents})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue