Connect back: a connection one client takes leaves the others waiting

The clients of a -R service all wait for the connection back on the
same listening socket, which was blocking: one connection woke them
all, one took it, and the others were left in accept() until the next,
past their time out and through a reload. The socket is non-blocking,
and an accept() which finds nothing, the connection taken by another
client or gone, is not one of the client's tries. nonblock() makes a
socket non-blocking, acceptagain() tells such an accept().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 126c7d00ec)
This commit is contained in:
Vladimir Dubrovin committed 2026-10-24 20:55:40 +03:00
1 parent f4c5c723bd
commit 2d06b4672a
4 files changed
+26

No files matched your search

+2
View File
@@ -332,6 +332,8 @@ int nsbroken(void);
/* a function everywhere, never a macro: its callers have preprocessor
lines among its arguments */
SOCKET nssocket(struct srvparam *srv, struct sockfuncs *sf, void *state, int side, int domain, int type, int protocol);
void nonblock(SOCKET sock);
int acceptagain(void);
int socksend(struct clientparam *param, SOCKET sock, unsigned char * buf, int bufsize, int to);
int socksendto(struct clientparam *param, SOCKET sock, struct sockaddr * sin, unsigned char * buf, int bufsize, int to);
int sockrecvfrom(struct clientparam *param, SOCKET sock, struct sockaddr * sin, unsigned char * buf, int bufsize, int to);