Skip to content

fix dial checking the wrong error #41

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chrishayen
Copy link

@chrishayen chrishayen commented Jun 2, 2025

Debugging file descriptor leak while calling dial on udp multiple times, for multiple addresses in a loop. Ran into this.

@ghost
Copy link

ghost commented Jun 2, 2025

Pull Request Revisions

RevisionDescription
r1
Fixed conditional statement syntax errorCorrected a syntax error in the TsnetDial function by adding an explicit assignment of the error to the conditional statement

✅ AI review completed for r1
Help React with emojis to give feedback on AI-generated reviews:
  • 👍 means the feedback was helpful and actionable
  • 👎 means the feedback was incorrect or unhelpful
💬 Replying to feedback with a comment helps us improve the system. Your input also contributes to shaping future interactions with the AI reviewer.

We'd love to hear from you—reach out anytime at [email protected].

@@ -405,7 +405,7 @@ func TsnetDial(sd C.int, network, addr *C.char, connOut *C.int) C.int {
if err != nil {
return s.recErr(err)
}
if newConn(s, netConn, connOut); err != nil {
if err := newConn(s, netConn, connOut); err != nil {
Copy link

Choose a reason for hiding this comment

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

This is a good fix. The original code was checking the wrong error variable - it was using the outer scope 'err' from the s.s.Dial call instead of capturing the error returned by newConn(). This could have led to silently ignoring errors from newConn() while incorrectly reporting errors from the Dial operation that had actually succeeded.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think it was falsely reporting errors for something that succeeds, but it possibly wasn't reporting errors for failures in newConn

Copy link
Author

Choose a reason for hiding this comment

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

@crawshaw I think this was yours.

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.

1 participant