mirror of
https://github.com/sot-tech/mochi.git
synced 2026-04-28 16:40:01 -07:00
Merge pull request #153 from mrd0ll4r/middleware-smallfix
hotfix: initialized scrape map
This commit is contained in:
@@ -71,7 +71,7 @@ func writeAnnounceResponse(w http.ResponseWriter, resp *chihaya.AnnounceResponse
|
||||
func writeScrapeResponse(w http.ResponseWriter, resp *chihaya.ScrapeResponse) error {
|
||||
filesDict := bencode.NewDict()
|
||||
for infohash, scrape := range resp.Files {
|
||||
filesDict[infohash] = bencode.Dict{
|
||||
filesDict[string(infohash)] = bencode.Dict{
|
||||
"complete": scrape.Complete,
|
||||
"incomplete": scrape.Incomplete,
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func responseScrapeClient(next tracker.ScrapeHandler) tracker.ScrapeHandler {
|
||||
return func(cfg *chihaya.TrackerConfig, req *chihaya.ScrapeRequest, resp *chihaya.ScrapeResponse) (err error) {
|
||||
storage := store.MustGetStore()
|
||||
for _, infoHash := range req.InfoHashes {
|
||||
resp.Files[string(infoHash)] = chihaya.Scrape{
|
||||
resp.Files[infoHash] = chihaya.Scrape{
|
||||
Complete: int32(storage.NumSeeders(infoHash)),
|
||||
Incomplete: int32(storage.NumLeechers(infoHash)),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user