Skip to content

Conversation

zoeyjodon
Copy link

case ENET_SOCKOPT_ERROR:
len = sizeof (int);
#ifndef __3DS__ //getsockopt is unreliable on 3DS
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len);
Copy link
Owner

Choose a reason for hiding this comment

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

Were you seeing this codepath get reached during your testing? I don't see anything that calls it.

Copy link
Author

Choose a reason for hiding this comment

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

I haven't seen it reached, I just added in this fix for completeness once I noticed it. Removing it wouldn't cause any issues if you'd prefer keeping the original behavior.

Copy link
Owner

Choose a reason for hiding this comment

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

What exactly do you mean when you say "getsockopt() is unreliable"? Are you talking about SO_ERROR specifically or just any getsockopt() call may fail randomly?

Copy link
Author

Choose a reason for hiding this comment

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

Specifically SO_ERROR, at least that's the only call that I've seen fail so far. Here's the related libctru issue if you're interested: devkitPro/libctru#412

Copy link
Owner

@cgutman cgutman Dec 20, 2023

Choose a reason for hiding this comment

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

OK, that will probably cause issues with moonlight-common-c, since we use SO_ERROR for non-blocking connects there too. I don't think ENet uses SO_ERROR, so can you remove this change?

Copy link
Author

Choose a reason for hiding this comment

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

Oh it definitely caused issues with moonlight-common-c, it was how I first learned about this bug. Good to know this isn't a problem in enet though. Reverted!

@cgutman cgutman merged commit 89a7ebd into cgutman:moonlight Dec 22, 2023
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