2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Don't start another holepunch rendezvous if we're handling one

This commit is contained in:
Matt Joiner 2023-05-18 10:26:00 +10:00
parent 92bba56b87
commit 9352f6cf8e
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
2 changed files with 4 additions and 2 deletions

View File

@ -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")

View 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) {