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

Networking bug fixes and cleanup #1462

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

slipher
Copy link
Member

@slipher slipher commented Dec 14, 2024

Note: nothing release-critical here

It was producing errors about the port being already in use, and thus
switching to port 27961 instead of 27960. This was caused by the socket
being inherited by NaCl processes.
NET_Config(bool enableNetworking) was a function to either open the
network sockets if the arg is true, or close them if it is false.
It checked the modified flag of a bunch of net_ cvars, with the idea
that if it is requested to enable networking while it was already
enabled, to not do anything unless the configuration is changed.
But actually this situation can never happen, so we can drop the modify
checks and always reinitialize.

NET_Config( true ) was only done in 4 places, none of which could
possibly omit the network (re-)initialization:
- NET_Init - only called once on startup
- NET_Restart - the point of /net_restart is to force reinitialization
- SV_Startup - this is only done in clients and starting the server is a
  state change for clients so restart can't be skipped
- SV_Shutdown - this is only done in clients and stopping the server is
  a state change for clients so restart can't be skipped.

Also split NET_Config into two functions NET_EnableNetworking and
NET_DisableNetworking for better readability.
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