diff --git a/src/generator.c b/src/generator.c index 32824ef5..bea23bf2 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1735,15 +1735,11 @@ retry: return NULL; } -/* Queue up to the requested amount */ -static void recruit_subproxy(proxy_instance_t *proxi, const char *buf) +static void recruit_subproxies(proxy_instance_t *proxi, const int recruits) { bool recruit = false; - int recruits = 1; pthread_t pth; - sscanf(buf, "recruit=%d", &recruits); - mutex_lock(&proxi->proxy_lock); if (!proxi->recruit) recruit = true; @@ -1755,6 +1751,15 @@ static void recruit_subproxy(proxy_instance_t *proxi, const char *buf) create_pthread(&pth, proxy_recruit, proxi); } +/* Queue up to the requested amount */ +static void recruit_subproxy(proxy_instance_t *proxi, const char *buf) +{ + int recruits = 1; + + sscanf(buf, "recruit=%d", &recruits); + recruit_subproxies(proxi, recruits); +} + static void *proxy_reconnect(void *arg) { proxy_instance_t *proxy = (proxy_instance_t *)arg;