Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(holepunch): add logging when DirectConnect execution fails #3146

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions p2p/protocol/holepunch/holepuncher.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ func (hp *holePuncher) directConnect(rp peer.ID) error {
for i := 1; i <= maxRetries; i++ {
addrs, obsAddrs, rtt, err := hp.initiateHolePunch(rp)
if err != nil {
log.Debugw("hole punching failed", "peer", rp, "error", err)
hp.tracer.ProtocolError(rp, err)
return err
}
Expand Down Expand Up @@ -184,9 +183,8 @@ func (hp *holePuncher) initiateHolePunch(rp peer.ID) ([]ma.Multiaddr, []ma.Multi

addr, obsAddr, rtt, err := hp.initiateHolePunchImpl(str)
if err != nil {
log.Debugf("%s", err)
str.Reset()
return addr, obsAddr, rtt, err
return addr, obsAddr, rtt, fmt.Errorf("failed to initiateHolePunch: %w", err)
}
return addr, obsAddr, rtt, err
}
Expand Down Expand Up @@ -278,7 +276,10 @@ func (nn *netNotifiee) Connected(_ network.Network, conn network.Conn) {
return
}

_ = hs.DirectConnect(conn.RemotePeer())
err := hs.DirectConnect(conn.RemotePeer())
if err != nil {
log.Debugf("attempt to perform DirectConnect to %s failed: %s", conn.RemotePeer(), err)
}
}()
}
}
Expand Down
Loading