Skip to content

Commit 8deaed7

Browse files
wlynxgMarcoPolo
andauthored
feat(holepunch): add logging when DirectConnect execution fails (#3146)
Co-authored-by: Marco Munizaga <[email protected]>
1 parent 9584246 commit 8deaed7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

p2p/protocol/holepunch/holepuncher.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func (hp *holePuncher) directConnect(rp peer.ID) error {
133133
for i := 1; i <= maxRetries; i++ {
134134
addrs, obsAddrs, rtt, err := hp.initiateHolePunch(rp)
135135
if err != nil {
136-
log.Debugw("hole punching failed", "peer", rp, "error", err)
137136
hp.tracer.ProtocolError(rp, err)
138137
return err
139138
}
@@ -184,9 +183,8 @@ func (hp *holePuncher) initiateHolePunch(rp peer.ID) ([]ma.Multiaddr, []ma.Multi
184183

185184
addr, obsAddr, rtt, err := hp.initiateHolePunchImpl(str)
186185
if err != nil {
187-
log.Debugf("%s", err)
188186
str.Reset()
189-
return addr, obsAddr, rtt, err
187+
return addr, obsAddr, rtt, fmt.Errorf("failed to initiateHolePunch: %w", err)
190188
}
191189
return addr, obsAddr, rtt, err
192190
}
@@ -278,7 +276,10 @@ func (nn *netNotifiee) Connected(_ network.Network, conn network.Conn) {
278276
return
279277
}
280278

281-
_ = hs.DirectConnect(conn.RemotePeer())
279+
err := hs.DirectConnect(conn.RemotePeer())
280+
if err != nil {
281+
log.Debugf("attempt to perform DirectConnect to %s failed: %s", conn.RemotePeer(), err)
282+
}
282283
}()
283284
}
284285
}

0 commit comments

Comments
 (0)