From 9352f6cf8e1fb6c125e205d0a10f8068e511d663 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 18 May 2023 10:26:00 +1000 Subject: [PATCH] Don't start another holepunch rendezvous if we're handling one --- client.go | 4 +++- torrent.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index e641ffab..bc9bafbb 100644 --- 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") diff --git a/torrent.go b/torrent.go index ad89b453..49ae0605 100644 --- a/torrent.go +++ b/torrent.go @@ -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) { -- 2.44.0