From 6e95cd1f669e05903320d6dd147bbe12211a66d7 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 23 Feb 2015 17:37:21 +1100 Subject: [PATCH] Revert "Use generic workqueues for the recruit subproxy function" This reverts commit 0ecd5b5098c076d57f58f46df963b946e87eb063. --- src/generator.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/generator.c b/src/generator.c index da3a11c4..08dda589 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1679,10 +1679,13 @@ static proxy_instance_t *create_subproxy(gdata_t *gdata, proxy_instance_t *proxi return subproxy; } -static void proxy_recruit(ckpool_t *ckp, proxy_instance_t *parent) +static void *proxy_recruit(void *arg) { + proxy_instance_t *proxy, *parent = (proxy_instance_t *)arg; + ckpool_t *ckp = parent->ckp; gdata_t *gdata = ckp->data; - proxy_instance_t *proxy; + + pthread_detach(pthread_self()); proxy = create_subproxy(gdata, parent); if (!proxy_alive(ckp, proxy->si, proxy, proxy->cs, false, parent->epfd)) { @@ -1690,11 +1693,14 @@ static void proxy_recruit(ckpool_t *ckp, proxy_instance_t *parent) store_proxy(gdata, proxy); } else add_subproxy(parent, proxy); + return NULL; } -static void recruit_subproxy(gdata_t *gdata, proxy_instance_t *proxi) +static void recruit_subproxy(proxy_instance_t *proxi) { - ckwq_add(gdata->ckwqs, &proxy_recruit, proxi); + pthread_t pth; + + create_pthread(&pth, proxy_recruit, proxi); } static void *proxy_reconnect(void *arg) @@ -1915,7 +1921,7 @@ static void *proxy_recv(void *arg) subproxy->id, subproxy->si->url); break; } else - recruit_subproxy(gdata, proxi); + recruit_subproxy(proxi); } continue; } @@ -2053,7 +2059,7 @@ retry: LOGDEBUG("Proxy received ping request"); send_unix_msg(sockd, "pong"); } else if (cmdmatch(buf, "recruit")) { - recruit_subproxy(gdata, proxi); + recruit_subproxy(proxi); } else if (cmdmatch(buf, "dropproxy")) { drop_proxy(gdata, buf); } else if (ckp->passthrough) {