Add Context parameter to SendResponse
This commit is contained in:
parent
7f3655a14b
commit
7d3d4bc088
|
@ -35,7 +35,7 @@ type AnnounceTracker = trackerServer.AnnounceTracker
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
ConnTracker ConnectionTracker
|
ConnTracker ConnectionTracker
|
||||||
SendResponse func(data []byte, addr net.Addr) (int, error)
|
SendResponse func(ctx context.Context, data []byte, addr net.Addr) (int, error)
|
||||||
Announce *trackerServer.AnnounceHandler
|
Announce *trackerServer.AnnounceHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ func (me *Server) handleAnnounce(
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buf.Write(b)
|
buf.Write(b)
|
||||||
n, err := me.SendResponse(buf.Bytes(), source)
|
n, err := me.SendResponse(ctx, buf.Bytes(), source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ func (me *Server) handleConnect(ctx context.Context, source RequestSourceAddr, t
|
||||||
TransactionId: tid,
|
TransactionId: tid,
|
||||||
})
|
})
|
||||||
udp.Write(&buf, udp.ConnectionResponse{connId})
|
udp.Write(&buf, udp.ConnectionResponse{connId})
|
||||||
n, err := me.SendResponse(buf.Bytes(), source)
|
n, err := me.SendResponse(ctx, buf.Bytes(), source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue