Browse Source

Abstract out recruit_subproxies function

master
ckolivas 10 years ago
parent
commit
e6b79715cb
  1. 15
      src/generator.c

15
src/generator.c

@ -1735,15 +1735,11 @@ retry:
return NULL; return NULL;
} }
/* Queue up to the requested amount */ static void recruit_subproxies(proxy_instance_t *proxi, const int recruits)
static void recruit_subproxy(proxy_instance_t *proxi, const char *buf)
{ {
bool recruit = false; bool recruit = false;
int recruits = 1;
pthread_t pth; pthread_t pth;
sscanf(buf, "recruit=%d", &recruits);
mutex_lock(&proxi->proxy_lock); mutex_lock(&proxi->proxy_lock);
if (!proxi->recruit) if (!proxi->recruit)
recruit = true; recruit = true;
@ -1755,6 +1751,15 @@ static void recruit_subproxy(proxy_instance_t *proxi, const char *buf)
create_pthread(&pth, proxy_recruit, proxi); 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) static void *proxy_reconnect(void *arg)
{ {
proxy_instance_t *proxy = (proxy_instance_t *)arg; proxy_instance_t *proxy = (proxy_instance_t *)arg;

Loading…
Cancel
Save