Browse Source

Fix passthrough/redirector trying to grab semaphore twice

master
ckolivas 9 years ago
parent
commit
45a44ace7e
  1. 7
      src/generator.c

7
src/generator.c

@ -708,6 +708,7 @@ out:
return ret; return ret;
} }
/* cs semaphore must be held */
static bool subscribe_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi) static bool subscribe_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi)
{ {
bool ret = false; bool ret = false;
@ -762,6 +763,7 @@ out:
return ret; return ret;
} }
/* cs semaphore must be held */
static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi) static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi)
{ {
json_t *req, *val = NULL, *res_val, *err_val; json_t *req, *val = NULL, *res_val, *err_val;
@ -772,8 +774,6 @@ static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi)
"method", "mining.passthrough", "method", "mining.passthrough",
"params", PACKAGE"/"VERSION); "params", PACKAGE"/"VERSION);
/* Serialise all send/recvs */
cksem_wait(&cs->sem);
ret = send_json_msg(cs, req); ret = send_json_msg(cs, req);
json_decref(req); json_decref(req);
if (!ret) { if (!ret) {
@ -799,8 +799,6 @@ static bool passthrough_stratum(connsock_t *cs, proxy_instance_t *proxi)
} }
proxi->passthrough = true; proxi->passthrough = true;
out: out:
cksem_post(&cs->sem);
if (val) if (val)
json_decref(val); json_decref(val);
if (!ret) if (!ret)
@ -1258,6 +1256,7 @@ out:
return ret; return ret;
} }
/* cs semaphore must be held */
static bool auth_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi) static bool auth_stratum(ckpool_t *ckp, connsock_t *cs, proxy_instance_t *proxi)
{ {
json_t *val = NULL, *res_val, *req, *err_val; json_t *val = NULL, *res_val, *req, *err_val;

Loading…
Cancel
Save