Repository navigation
soc_getsockopt: report the pending error for SO_ERROR - #611
Closed
Migushthe2nd wants to merge 2 commits into
Closed
Migushthe2nd wants to merge 2 commits into
Migushthe2nd wants to merge 2 commits into
Conversation
added 2 commits
October 13, 2026 22:34
The SOC service doesn't wake a poll() waiting for POLLOUT when a non-blocking connect() completes, so poll() only returns once its timeout runs out (curl waits a second per new connection this way). It also reports a refused connection only as readable, so a POLLOUT waiter never learns about it. Wait for POLLOUT in 10 ms slices, and watch those sockets for POLLIN too: POLLIN without POLLOUT on a socket that then fails to receive is a failed connection, reported as POLLERR | POLLHUP. Nothing tells a socket that is still connecting from a connected one (getpeername() succeeds for both), so connected sockets waiting for POLLOUT are sliced as well. Waits for POLLIN alone are unchanged. Fixes the poll() part of devkitPro#412.
For SO_ERROR the service returns the result code of an earlier operation on the socket, in its own codes, instead of the socket's pending error: -26 (EINPROGRESS) after a non-blocking connect(), even once it has completed. Convert the code, and for the ones that aren't errors of the socket itself (EINPROGRESS, EALREADY, ENOTCONN, EAGAIN) report whether its connection failed instead: 0, or the reason (ECONNREFUSED for a refused connection). Fixes the SO_ERROR part of devkitPro#412.
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.
LLM-generated content removed