]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Make use of the new context parameter in conntrack Wait
authorMatt Joiner <anacrolix@gmail.com>
Sun, 10 Mar 2019 23:43:02 +0000 (10:43 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 10 Mar 2019 23:46:06 +0000 (10:46 +1100)
client.go

index a247b3c4da00ec6afc02e256bfdcc87ece07c7cc..ba6599fa930b533cce75889363c499a074c85508 100644 (file)
--- 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