tracker: record announce/scrape stats in handlers

This deduplicates code tracking the stats code tracking announces and
scrapes for each protocol. The down side is that it isn't aware of any
failures writing responses, but it was already being called before the
write to a response for HTTP.
This commit is contained in:
Jimmy Zelinskie
2015-02-26 09:03:52 -05:00
parent 9b4999c0cf
commit ac2fcade1e
3 changed files with 6 additions and 5 deletions

View File

@@ -70,6 +70,7 @@ func (tkr *Tracker) HandleAnnounce(ann *models.Announce, w Writer) (err error) {
stats.RecordEvent(stats.DeletedTorrent)
}
stats.RecordEvent(stats.Announce)
return w.WriteAnnounce(newAnnounceResponse(ann))
}