|
|
@ -549,7 +549,8 @@ static bool parse_subscribe(connsock_t *cs, proxy_instance_t *proxi) |
|
|
|
retry: |
|
|
|
retry: |
|
|
|
parsed = true; |
|
|
|
parsed = true; |
|
|
|
if (!(buf = new_proxy_line(cs))) { |
|
|
|
if (!(buf = new_proxy_line(cs))) { |
|
|
|
LOGWARNING("Failed to receive line in parse_subscribe"); |
|
|
|
LOGWARNING("Proxy %d:%s failed to receive line in parse_subscribe", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
LOGDEBUG("parse_subscribe received %s", buf); |
|
|
|
LOGDEBUG("parse_subscribe received %s", buf); |
|
|
@ -581,7 +582,8 @@ retry: |
|
|
|
buf = NULL; |
|
|
|
buf = NULL; |
|
|
|
goto retry; |
|
|
|
goto retry; |
|
|
|
} |
|
|
|
} |
|
|
|
LOGWARNING("Failed to parse subscribe response in parse_subscribe"); |
|
|
|
LOGWARNING("Proxy %d:%s failed to parse subscribe response in parse_subscribe", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -623,7 +625,7 @@ retry: |
|
|
|
LOGWARNING("Invalid nonce2len %d in parse_subscribe", size); |
|
|
|
LOGWARNING("Invalid nonce2len %d in parse_subscribe", size); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (size == 3) |
|
|
|
if (size == 3 || (size == 4 && proxi->ckp->clientsvspeed)) |
|
|
|
LOGWARNING("Nonce2 length %d means proxied clients can't be >5TH each", size); |
|
|
|
LOGWARNING("Nonce2 length %d means proxied clients can't be >5TH each", size); |
|
|
|
else if (size < 3) { |
|
|
|
else if (size < 3) { |
|
|
|
LOGWARNING("Nonce2 length %d too small to be able to proxy", size); |
|
|
|
LOGWARNING("Nonce2 length %d too small to be able to proxy", size); |
|
|
@ -670,7 +672,8 @@ retry: |
|
|
|
ret = send_json_msg(cs, req); |
|
|
|
ret = send_json_msg(cs, req); |
|
|
|
json_decref(req); |
|
|
|
json_decref(req); |
|
|
|
if (!ret) { |
|
|
|
if (!ret) { |
|
|
|
LOGWARNING("Failed to send message in subscribe_stratum"); |
|
|
|
LOGWARNING("Proxy %d:%s failed to send message in subscribe_stratum", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
ret = parse_subscribe(cs, proxi); |
|
|
|
ret = parse_subscribe(cs, proxi); |
|
|
@ -678,20 +681,24 @@ retry: |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
|
|
|
|
|
|
|
|
if (proxi->no_params) { |
|
|
|
if (proxi->no_params) { |
|
|
|
LOGWARNING("Failed all subscription options in subscribe_stratum"); |
|
|
|
LOGWARNING("Proxy %d:%s failed all subscription options in subscribe_stratum", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
if (proxi->sessionid) { |
|
|
|
if (proxi->sessionid) { |
|
|
|
LOGNOTICE("Failed sessionid reconnect in subscribe_stratum, retrying without"); |
|
|
|
LOGNOTICE("Proxy %d:%s failed sessionid reconnect in subscribe_stratum, retrying without", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
proxi->no_sessionid = true; |
|
|
|
proxi->no_sessionid = true; |
|
|
|
dealloc(proxi->sessionid); |
|
|
|
dealloc(proxi->sessionid); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LOGNOTICE("Failed connecting with parameters in subscribe_stratum, retrying without"); |
|
|
|
LOGNOTICE("Proxy %d:%s failed connecting with parameters in subscribe_stratum, retrying without", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
proxi->no_params = true; |
|
|
|
proxi->no_params = true; |
|
|
|
} |
|
|
|
} |
|
|
|
ret = connect_proxy(cs); |
|
|
|
ret = connect_proxy(cs); |
|
|
|
if (!ret) { |
|
|
|
if (!ret) { |
|
|
|
LOGWARNING("Failed to reconnect in subscribe_stratum"); |
|
|
|
LOGWARNING("Proxy %d:%s failed to reconnect in subscribe_stratum", |
|
|
|
|
|
|
|
proxi->id, proxi->si->url); |
|
|
|
goto out; |
|
|
|
goto out; |
|
|
|
} |
|
|
|
} |
|
|
|
goto retry; |
|
|
|
goto retry; |
|
|
|