]> Sergey Matveev's repositories - btrtrc.git/blobdiff - client.go
Don't start another holepunch rendezvous if we're handling one
[btrtrc.git] / client.go
index 6a82774e7a0d5cf8f0fa4b265161de1076a40609..bc9bafbbd8fd95b065ebd03bc154426729fc37e9 100644 (file)
--- a/client.go
+++ b/client.go
@@ -771,7 +771,9 @@ func (cl *Client) dialAndCompleteHandshake(opts outgoingConnOpts) (c *PeerConn,
                        if !opts.receivedHolepunchConnect {
                                g.MakeMapIfNilAndSet(&cl.undialableWithoutHolepunch, holepunchAddr, struct{}{})
                        }
-                       opts.t.startHolepunchRendezvous(holepunchAddr)
+                       if !opts.skipHolepunchRendezvous {
+                               opts.t.trySendHolepunchRendezvous(holepunchAddr)
+                       }
                        cl.unlock()
                }
                err = fmt.Errorf("all initial dials failed")
@@ -1582,6 +1584,7 @@ func (cl *Client) newConnection(nc net.Conn, opts newConnectionOpts) (c *PeerCon
        }
        c.peerImpl = c
        c.logger = cl.logger.WithDefaultLevel(log.Warning)
+       c.logger = c.logger.WithContextText(fmt.Sprintf("%T %p", c, c))
        c.setRW(connStatsReadWriter{nc, c})
        c.r = &rateLimitedReader{
                l: cl.config.DownloadRateLimiter,