Browse Source

Increment proxy count only after new proxy is set up

master
Con Kolivas 10 years ago
parent
commit
43d1336321
  1. 5
      src/generator.c

5
src/generator.c

@ -853,8 +853,8 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val)
ret = true; ret = true;
newsi = ckzalloc(sizeof(server_instance_t)); newsi = ckzalloc(sizeof(server_instance_t));
newsi->id = ckp->proxies++; newsi->id = ckp->proxies;
ckp->servers = realloc(ckp->servers, sizeof(server_instance_t *) * ckp->proxies); ckp->servers = realloc(ckp->servers, sizeof(server_instance_t *) * (ckp->proxies + 1));
ckp->servers[newsi->id] = newsi; ckp->servers[newsi->id] = newsi;
newsi->url = url; newsi->url = url;
newsi->auth = strdup(si->auth); newsi->auth = strdup(si->auth);
@ -872,6 +872,7 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val)
proxi->cs = &newsi->cs; proxi->cs = &newsi->cs;
/* Set chosen server only once all new proxy data exists */ /* Set chosen server only once all new proxy data exists */
ckp->proxies++;
ckp->chosen_server = newsi->id; ckp->chosen_server = newsi->id;
out: out:
return ret; return ret;

Loading…
Cancel
Save