]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Don't start another holepunch rendezvous if we're handling one
authorMatt Joiner <anacrolix@gmail.com>
Thu, 18 May 2023 00:26:00 +0000 (10:26 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 18 May 2023 00:26:00 +0000 (10:26 +1000)
client.go
torrent.go

index e641ffab74588b9c7d767f5648e2f0588bd5b14c..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")
index ad89b45391cc9df92616888a369c67b09245b0e2..49ae06054d4b362c87f892652f15e9c1e0a7bed4 100644 (file)
@@ -2825,7 +2825,7 @@ func (t *Torrent) handleReceivedUtHolepunchMsg(msg utHolepunch.Msg, sender *Peer
        }
 }
 
-func (t *Torrent) startHolepunchRendezvous(addrPort netip.AddrPort) error {
+func (t *Torrent) trySendHolepunchRendezvous(addrPort netip.AddrPort) error {
        rzsSent := 0
        for pc := range t.conns {
                if !pc.supportsExtension(utHolepunch.ExtensionName) {