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
@@ -23,6 +23,8 @@ static int cblisten(struct srvstart *s){
return -6;
}
setopts(srv->cbsock, &srv->cbssockopts, srv->maxseg);
/* the clients of the service all wait for it: one accepts what comes */
nonblock(srv->cbsock);
if(srv->so._bind(srv->so.state, srv->cbsock, (struct sockaddr*)&cbsa, SASIZE(&cbsa))==-1) {
dolog(defparam, (unsigned char *)"Failed to bind connect back socket");