mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Reattach: a new service's slot for its next client taken before it is found
A TCP service keeps one of its maxconn slots for the next client it accepts, but took it only once its thread reached the accept loop. A reload puts the new service on its listener (mainclaim(), in the thread reading the configuration) before its thread even starts, and the clients of the old services move to it as soon as they see it there: in that window they could take every slot, the one it keeps included. The reattach test, with maxconn 2, then had both of two downloads go on instead of one, now and then on a loaded runner, every time with a 300 ms sleep put in the window. mainclaim() takes the slot first; srvrun() takes it over, and srvdiscard() gives it back for a service which never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2052dc0a4f
commit
7fab9c488d
3 files changed
+17
-1
No files matched your search
@@ -152,6 +152,11 @@ static void srvstrings(struct srvstart *s){
|
||||
|
||||
/* Releases what the preparation and the run took, s itself excepted. */
|
||||
static void srvdiscard(struct srvstart *s){
|
||||
/* a slot taken for a service which never ran: srvfree() waits for all */
|
||||
if(s->haveslot){
|
||||
_3proxy_sem_unlock(s->srv.childslots);
|
||||
s->haveslot = 0;
|
||||
}
|
||||
srvfree(&s->srv);
|
||||
srvstrings(s);
|
||||
}
|
||||
@@ -245,6 +250,7 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
|
||||
|
||||
s->cbc_string = s->cbl_string = NULL;
|
||||
s->iscbc = s->iscbl = 0;
|
||||
s->haveslot = 0;
|
||||
#ifdef STDMAIN
|
||||
#ifndef _WIN32
|
||||
s->inetd = 0;
|
||||
|
||||
Reference in new issue
Block a user