Add Context parameter to SendResponse

This commit is contained in:
Matt Joiner 2022-12-29 10:22:03 +11:00
parent 7f3655a14b
commit 7d3d4bc088
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
1 changed files with 3 additions and 3 deletions

View File

@ -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
} }