|
|
@ -1885,6 +1885,7 @@ static bool subproxies_alive(proxy_instance_t *proxy) |
|
|
|
static void *proxy_recv(void *arg) |
|
|
|
static void *proxy_recv(void *arg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
proxy_instance_t *proxi = (proxy_instance_t *)arg; |
|
|
|
proxy_instance_t *proxi = (proxy_instance_t *)arg; |
|
|
|
|
|
|
|
proxy_instance_t *subproxy, *tmp; |
|
|
|
server_instance_t *si = proxi->si; |
|
|
|
server_instance_t *si = proxi->si; |
|
|
|
connsock_t *cs = proxi->cs; |
|
|
|
connsock_t *cs = proxi->cs; |
|
|
|
ckpool_t *ckp = proxi->ckp; |
|
|
|
ckpool_t *ckp = proxi->ckp; |
|
|
@ -1909,12 +1910,12 @@ static void *proxy_recv(void *arg) |
|
|
|
reconnect_generator(ckp); |
|
|
|
reconnect_generator(ckp); |
|
|
|
|
|
|
|
|
|
|
|
while (42) { |
|
|
|
while (42) { |
|
|
|
proxy_instance_t *subproxy = proxi; |
|
|
|
|
|
|
|
share_msg_t *share, *tmpshare; |
|
|
|
share_msg_t *share, *tmpshare; |
|
|
|
notify_instance_t *ni, *tmp; |
|
|
|
notify_instance_t *ni, *tmp; |
|
|
|
time_t now; |
|
|
|
time_t now; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subproxy = proxi; |
|
|
|
if (!proxi->alive) { |
|
|
|
if (!proxi->alive) { |
|
|
|
reconnect_proxy(proxi); |
|
|
|
reconnect_proxy(proxi); |
|
|
|
while (!subproxies_alive(proxi)) { |
|
|
|
while (!subproxies_alive(proxi)) { |
|
|
@ -1996,6 +1997,18 @@ static void *proxy_recv(void *arg) |
|
|
|
} while ((ret = read_socket_line(cs, 0)) > 0); |
|
|
|
} while ((ret = read_socket_line(cs, 0)) > 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&proxi->proxy_lock); |
|
|
|
|
|
|
|
HASH_ITER(sh, proxi->subproxies, subproxy, tmp) { |
|
|
|
|
|
|
|
subproxy->disabled = true; |
|
|
|
|
|
|
|
send_stratifier_deadproxy(ckp, subproxy->id, subproxy->subid); |
|
|
|
|
|
|
|
if (subproxy->cs->fd > 0) { |
|
|
|
|
|
|
|
epoll_ctl(epfd, EPOLL_CTL_DEL, subproxy->cs->fd, NULL); |
|
|
|
|
|
|
|
Close(subproxy->cs->fd); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
HASH_DELETE(sh, proxi->subproxies, subproxy); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
mutex_unlock(&proxi->proxy_lock); |
|
|
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|