udp: add scrape address length to context

This commit is contained in:
Leo Balduf 2016-09-08 11:38:25 -04:00
parent 3ec6f10e93
commit 1bd28b097c

View file

@ -15,6 +15,7 @@ import (
"github.com/chihaya/chihaya/bittorrent"
"github.com/chihaya/chihaya/frontend"
"github.com/chihaya/chihaya/frontend/udp/bytepool"
"github.com/chihaya/chihaya/middleware"
)
func init() {
@ -222,8 +223,10 @@ func (t *Frontend) handleRequest(r Request, w ResponseWriter) (actionName string
return
}
ctx := context.WithValue(context.Background(), middleware.ScrapeIsIPv6Key, len(r.IP) == net.IPv6len)
var resp *bittorrent.ScrapeResponse
resp, err = t.logic.HandleScrape(context.Background(), req)
resp, err = t.logic.HandleScrape(ctx, req)
if err != nil {
WriteError(w, txID, err)
return