Browse Source

Use generic workqueues for the recruit subproxy function

master
Con Kolivas 10 years ago
parent
commit
0ecd5b5098
  1. 18
      src/generator.c

18
src/generator.c

@ -1678,13 +1678,10 @@ static proxy_instance_t *create_subproxy(gdata_t *gdata, proxy_instance_t *proxi
return subproxy;
}
static void *proxy_recruit(void *arg)
static void proxy_recruit(ckpool_t *ckp, proxy_instance_t *parent)
{
proxy_instance_t *proxy, *parent = (proxy_instance_t *)arg;
ckpool_t *ckp = parent->ckp;
gdata_t *gdata = ckp->data;
pthread_detach(pthread_self());
proxy_instance_t *proxy;
proxy = create_subproxy(gdata, parent);
if (!proxy_alive(ckp, proxy->si, proxy, proxy->cs, false, parent->epfd)) {
@ -1692,14 +1689,11 @@ static void *proxy_recruit(void *arg)
store_proxy(gdata, proxy);
} else
add_subproxy(parent, proxy);
return NULL;
}
static void recruit_subproxy(proxy_instance_t *proxi)
static void recruit_subproxy(gdata_t *gdata, proxy_instance_t *proxi)
{
pthread_t pth;
create_pthread(&pth, proxy_recruit, proxi);
ckwq_add(gdata->ckwqs, &proxy_recruit, proxi);
}
static void *proxy_reconnect(void *arg)
@ -1920,7 +1914,7 @@ static void *proxy_recv(void *arg)
subproxy->id, subproxy->si->url);
break;
} else
recruit_subproxy(proxi);
recruit_subproxy(gdata, proxi);
}
continue;
}
@ -2058,7 +2052,7 @@ retry:
LOGDEBUG("Proxy received ping request");
send_unix_msg(sockd, "pong");
} else if (cmdmatch(buf, "recruit")) {
recruit_subproxy(proxi);
recruit_subproxy(gdata, proxi);
} else if (cmdmatch(buf, "dropproxy")) {
drop_proxy(gdata, buf);
} else if (ckp->passthrough) {

Loading…
Cancel
Save