Skip to content

fix: set accepted client sockets to non-blocking mode - #18

Open
EclipseWraith wants to merge 1 commit into
nsb-ucsc:mainfrom
EclipseWraith:fix/daemon-nonblocking-sockets
Open

fix: set accepted client sockets to non-blocking mode#18
EclipseWraith wants to merge 1 commit into
nsb-ucsc:mainfrom
EclipseWraith:fix/daemon-nonblocking-sockets

Conversation

@EclipseWraith

Copy link
Copy Markdown

On Linux, accept() does not inherit O_NONBLOCK from the listening socket. This caused the recv() loop in start_server()
to block indefinitely after reading the first message, preventing Python clients from completing initialization.

Fixed by applying fcntl(F_SETFL, O_NONBLOCK) to accepted client sockets immediately after accept().

Tested on Ubuntu 24.04 (WSL2).

On Linux, accept() does not inherit O_NONBLOCK from the listening
socket. This caused the daemon's recv() loop to block indefinitely
after reading the initial message chunk, preventing any Python client
from completing initialization.

Added fcntl(F_SETFL, O_NONBLOCK) on accepted client sockets
immediately after accept() to match the server socket's non-blocking
behavior.
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