Browse Source

Don't reset the chosen_server value in live_proxy

master
Con Kolivas 10 years ago
parent
commit
d66befef02
  1. 8
      src/generator.c

8
src/generator.c

@ -1475,16 +1475,16 @@ out:
/* Cycle through the available proxies and find the first alive one */ /* Cycle through the available proxies and find the first alive one */
static proxy_instance_t *live_proxy(ckpool_t *ckp) static proxy_instance_t *live_proxy(ckpool_t *ckp)
{ {
int i, start_from = ckp->chosen_server;
proxy_instance_t *alive = NULL; proxy_instance_t *alive = NULL;
connsock_t *cs; connsock_t *cs;
int i;
LOGDEBUG("Attempting to connect to proxy"); LOGDEBUG("Attempting to connect to proxy");
retry: retry:
if (!ping_main(ckp)) if (!ping_main(ckp))
goto out; goto out;
for (i = ckp->chosen_server; i < ckp->proxies; i++) { for (i = start_from; i < ckp->proxies; i++) {
proxy_instance_t *proxi; proxy_instance_t *proxi;
server_instance_t *si; server_instance_t *si;
@ -1499,13 +1499,13 @@ retry:
if (!alive) { if (!alive) {
send_proc(ckp->connector, "reject"); send_proc(ckp->connector, "reject");
send_proc(ckp->stratifier, "dropall"); send_proc(ckp->stratifier, "dropall");
if (!ckp->chosen_server) { if (!start_from) {
LOGWARNING("Failed to connect to any servers as proxy, retrying in 5s!"); LOGWARNING("Failed to connect to any servers as proxy, retrying in 5s!");
sleep(5); sleep(5);
} }
goto retry; goto retry;
} }
ckp->chosen_server = 0; start_from = 0;
cs = alive->cs; cs = alive->cs;
LOGNOTICE("Connected to upstream server %s:%s as proxy%s", cs->url, cs->port, LOGNOTICE("Connected to upstream server %s:%s as proxy%s", cs->url, cs->port,
ckp->passthrough ? " in passthrough mode" : ""); ckp->passthrough ? " in passthrough mode" : "");

Loading…
Cancel
Save