Skip to content

Conversation

wlynxg
Copy link
Contributor

@wlynxg wlynxg commented Feb 12, 2025

When I tested the relay connection with the new version, I was able to successfully connect to the server peer, but a context deadline exceeded error occurred when calling NewStream because WithAllowLimitedConn was not used.

This error caused me trouble, and I finally found that it was a timeout in waitForDirectConn (because my environment could not successfully holepunch).

Logging the errors returned by waitForDirectConn can help more developers locate errors and know through code logic that WithAllowLimitedConn is needed.

@wlynxg wlynxg force-pushed the swarm_allow_limited branch from 04c7284 to cb1ebb4 Compare February 12, 2025 09:23
@wlynxg wlynxg changed the title feat(swarm): add more error information for waitForDirectConn feat(swarm): logging waitForDirectConn return error Feb 12, 2025
@@ -510,6 +510,7 @@ func (s *Swarm) NewStream(ctx context.Context, p peer.ID) (network.Stream, error
var err error
c, err = s.waitForDirectConn(ctx, p)
if err != nil {
log.Debugf("[%s] waitForDirectConn error: %s", p, err)
Copy link
Member

@sukunrt sukunrt Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Debugf("[%s] waitForDirectConn error: %s", p, err)
log.Debugf("failed to upgrade limited conn to direct conn for peer %s: %s", p, err)

Copy link
Member

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you make the line more verbose? I suggested an alternative.

@sukunrt sukunrt merged commit 6ce2043 into libp2p:master Feb 12, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants