|
|
@ -988,11 +988,11 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val) |
|
|
|
{ |
|
|
|
{ |
|
|
|
server_instance_t *newsi, *si = proxi->si; |
|
|
|
server_instance_t *newsi, *si = proxi->si; |
|
|
|
proxy_instance_t *parent, *newproxi; |
|
|
|
proxy_instance_t *parent, *newproxi; |
|
|
|
|
|
|
|
bool sameurl = false, ret = false; |
|
|
|
int64_t high_id, low_id, new_id; |
|
|
|
int64_t high_id, low_id, new_id; |
|
|
|
ckpool_t *ckp = proxi->ckp; |
|
|
|
ckpool_t *ckp = proxi->ckp; |
|
|
|
gdata_t *gdata = ckp->data; |
|
|
|
gdata_t *gdata = ckp->data; |
|
|
|
const char *new_url; |
|
|
|
const char *new_url; |
|
|
|
bool ret = false; |
|
|
|
|
|
|
|
int new_port; |
|
|
|
int new_port; |
|
|
|
char *url; |
|
|
|
char *url; |
|
|
|
|
|
|
|
|
|
|
@ -1029,14 +1029,23 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val) |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
ASPRINTF(&url, "%s:%d", new_url, new_port); |
|
|
|
ASPRINTF(&url, "%s:%d", new_url, new_port); |
|
|
|
} else |
|
|
|
} else { |
|
|
|
url = strdup(si->url); |
|
|
|
url = strdup(si->url); |
|
|
|
|
|
|
|
sameurl = true; |
|
|
|
|
|
|
|
} |
|
|
|
LOGINFO("Processing reconnect request to %s", url); |
|
|
|
LOGINFO("Processing reconnect request to %s", url); |
|
|
|
|
|
|
|
|
|
|
|
ret = true; |
|
|
|
ret = true; |
|
|
|
|
|
|
|
parent = proxi->parent; |
|
|
|
|
|
|
|
/* If this is the same url we don't need to replace any existing
|
|
|
|
|
|
|
|
* parents, just drop the connection and allow a new one to be |
|
|
|
|
|
|
|
* recruited. */ |
|
|
|
|
|
|
|
if (sameurl) { |
|
|
|
|
|
|
|
disable_subproxy(gdata, parent, proxi); |
|
|
|
|
|
|
|
goto out; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* If this isn't a parent proxy, recruit a new parent! */ |
|
|
|
/* If this isn't a parent proxy, recruit a new parent! */ |
|
|
|
parent = proxi->parent; |
|
|
|
|
|
|
|
if (parent != proxi) { |
|
|
|
if (parent != proxi) { |
|
|
|
proxi->reconnect = true; |
|
|
|
proxi->reconnect = true; |
|
|
|
/* Do we already know this proxy is redirecting? */ |
|
|
|
/* Do we already know this proxy is redirecting? */ |
|
|
|