Skip to content
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

Reduce 3DS MTU #14

Merged
merged 10 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
4 changes: 2 additions & 2 deletions include/enet/protocol.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
@file protocol.h
@brief ENet protocol
*/
Expand All @@ -10,7 +10,7 @@
enum
{
ENET_PROTOCOL_MINIMUM_MTU = 576,
#ifdef __WIIU__
#if defined(__WIIU__) || defined(__3DS__)
ENET_PROTOCOL_MAXIMUM_MTU = 1400,
cgutman marked this conversation as resolved.
Show resolved Hide resolved
#else
ENET_PROTOCOL_MAXIMUM_MTU = 4096,
Expand Down
4 changes: 4 additions & 0 deletions unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
{
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!

#else
result = 0;
#endif
break;

case ENET_SOCKOPT_TTL:
Expand Down