mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-30 11:08:10 -07:00
udp: fix ordering of scrapes
This commit is contained in:
+1
-1
@@ -183,7 +183,7 @@ func (h *responseHook) HandleScrape(ctx context.Context, req *bittorrent.ScrapeR
|
||||
}
|
||||
|
||||
for _, infoHash := range req.InfoHashes {
|
||||
resp.Files[infoHash] = h.store.ScrapeSwarm(infoHash, req.AddressFamily)
|
||||
resp.Files = append(resp.Files, h.store.ScrapeSwarm(infoHash, req.AddressFamily))
|
||||
}
|
||||
|
||||
return ctx, nil
|
||||
|
||||
@@ -78,7 +78,7 @@ func (l *Logic) AfterAnnounce(ctx context.Context, req *bittorrent.AnnounceReque
|
||||
// HandleScrape generates a response for a Scrape.
|
||||
func (l *Logic) HandleScrape(ctx context.Context, req *bittorrent.ScrapeRequest) (resp *bittorrent.ScrapeResponse, err error) {
|
||||
resp = &bittorrent.ScrapeResponse{
|
||||
Files: make(map[bittorrent.InfoHash]bittorrent.Scrape),
|
||||
Files: make([]bittorrent.Scrape, 0, len(req.InfoHashes)),
|
||||
}
|
||||
for _, h := range l.preHooks {
|
||||
if ctx, err = h.HandleScrape(ctx, req, resp); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user