From: Matt Joiner Date: Sun, 10 Mar 2019 23:43:02 +0000 (+1100) Subject: Make use of the new context parameter in conntrack Wait X-Git-Tag: v1.1.0~6 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=5829c301465469c7991a175c3815390af21b2535;p=btrtrc.git Make use of the new context parameter in conntrack Wait --- diff --git a/client.go b/client.go index a247b3c4..ba6599fa 100644 --- a/client.go +++ b/client.go @@ -516,10 +516,15 @@ func (cl *Client) dialFirst(ctx context.Context, addr string) dialResult { left++ go func() { cte := cl.config.ConnTracker.Wait( + ctx, conntrack.Entry{network, s.Addr().String(), addr}, "dial torrent client", 0, ) + if ctx.Err() != nil { + resCh <- dialResult{} + return + } c, err := s.dial(ctx, addr) // This is a bit optimistic, but it looks non-trivial to thread // this through the proxy code. Set it now in case we close the