Upstream Fix: Library exits on "socket 0" error#10
Merged
starnight merged 2 commits intostarnight:masterfrom Jan 18, 2026
Merged
Upstream Fix: Library exits on "socket 0" error#10starnight merged 2 commits intostarnight:masterfrom
starnight merged 2 commits intostarnight:masterfrom
Conversation
Only negative numbers indicate an error. 0 is a normal socket, and usually just the first socket to be created. Fixes: starnight#9
starnight
requested changes
Jan 18, 2026
Owner
starnight
left a comment
There was a problem hiding this comment.
Thanks for you PR. The idea seems good.
However, left the coding style review comment. Besides, callers of HTTPServerInit() must handle the returned error from HTTPServerInit(). Otherwise, the application will be on weird state.
Using "exit" in a library isn't too great, depending on the application. In an embedded environment, where the application may have other functions, it's better to just return an error. Removes the use of "exit". Adds a return status to HTTPServerInit. Also adds protective checks in HTTPServerRun and HTTPServerClose, if these were called, despite HTTPServerInit failing (so socket was invalid). See: starnight#9
abf10e8 to
f1e8833
Compare
starnight
approved these changes
Jan 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Library exits on "socket 0" error, #9
Contains two commits. The first fixes the actual problem (socket 0).
The second is a suggestion to avoid using "exit" in the libraries - and adds a return code and protective checks instead.