Browse Source

Add reconnect sends to alive bool changing on proxy conditions to try and fail over/back

master
Con Kolivas 9 years ago
parent
commit
012d94dd35
  1. 4
      src/generator.c

4
src/generator.c

@ -1932,12 +1932,14 @@ static void *passthrough_recv(void *arg)
} }
if (!alive) { if (!alive) {
reconnect_generator(ckp); reconnect_generator(ckp);
LOGWARNING("Passthrough %d:%s recovered", proxi->id, proxi->url);
alive = true; alive = true;
} }
/* Make sure we receive a line within 90 seconds */ /* Make sure we receive a line within 90 seconds */
ret = read_socket_line(cs, &timeout); ret = read_socket_line(cs, &timeout);
if (ret < 1) { if (ret < 1) {
reconnect_generator(ckp);
LOGWARNING("Proxy %d:%s failed to read_socket_line in passthrough_recv, attempting reconnect", LOGWARNING("Proxy %d:%s failed to read_socket_line in passthrough_recv, attempting reconnect",
proxi->id, proxi->url); proxi->id, proxi->url);
alive = proxi->alive = false; alive = proxi->alive = false;
@ -2009,6 +2011,7 @@ static void *proxy_recv(void *arg)
while (!subproxies_alive(proxi)) { while (!subproxies_alive(proxi)) {
reconnect_proxy(proxi); reconnect_proxy(proxi);
if (alive) { if (alive) {
reconnect_generator(ckp);
LOGWARNING("Proxy %d:%s failed, attempting reconnect", LOGWARNING("Proxy %d:%s failed, attempting reconnect",
proxi->id, proxi->url); proxi->id, proxi->url);
alive = false; alive = false;
@ -2017,6 +2020,7 @@ static void *proxy_recv(void *arg)
} }
} }
if (!alive) { if (!alive) {
reconnect_generator(ckp);
LOGWARNING("Proxy %d:%s recovered", proxi->id, proxi->url); LOGWARNING("Proxy %d:%s recovered", proxi->id, proxi->url);
alive = true; alive = true;
} }

Loading…
Cancel
Save