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

[core] Make UDP sockets nonblocking to print error on EWOULDBLOCK #6374

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

Conversation

WinterSolstice8
Copy link
Member

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

Make UDP sockets nonblocking to print error on EWOULDBLOCK

Horizon has had a new event where they have >350 people in a single zone and there's a ton of lag. This PR is an attempt to prove/disprove that too many people causes sockets to block from not having enough buffer to send.

Steps to test these changes

Run server, see no changes under normal load.

@WinterSolstice8 WinterSolstice8 marked this pull request as ready for review October 20, 2024 04:16
@WinterSolstice8
Copy link
Member Author

Finished testing on Linux and Windows. Can't test OSX but not sure why it wouldn't work.

if (retval < 0)
{
int err = 0;
#ifdef WIN32_
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you don't need to ifdef this, we have win/unix things like this defined:

#define sErrno         WSAGetLastError()
#define S_ENOTSOCK     WSAENOTSOCK
#define S_EWOULDBLOCK  WSAEWOULDBLOCK
#define S_EINTR        WSAEINTR
#define S_ECONNABORTED WSAECONNABORTED

and

#define sErrno         errno
#define S_ENOTSOCK     EBADF
#define S_EWOULDBLOCK  EAGAIN
#define S_EINTR        EINTR
#define S_ECONNABORTED ECONNABORTED

So you'd check against S_ENOTSOCK || S_EWOULDBLOCK, or somesuch

Copy link
Contributor

@zach2good zach2good Oct 20, 2024

Choose a reason for hiding this comment

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

And for OSX in general: if it compiles, assume it's working. It's a secondary platform for us that exists so I can make builds on my Mac :D

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