mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-28 07:24:14 +00:00
Don't keep any json references around with stratum structures.
This commit is contained in:
parent
7e2dcc6fff
commit
d416d22381
30
util.c
30
util.c
@ -992,10 +992,9 @@ static bool parse_stratum(struct pool *pool, char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!ret) {
|
if (val)
|
||||||
if (val)
|
json_decref(val);
|
||||||
json_decref(val);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1020,11 +1019,8 @@ bool auth_stratum(struct pool *pool)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!ret) {
|
if (val)
|
||||||
if (val)
|
json_decref(val);
|
||||||
json_decref(val);
|
|
||||||
} else
|
|
||||||
pool->stratum_val = val;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1098,13 +1094,13 @@ bool initiate_stratum(struct pool *pool)
|
|||||||
applog(LOG_WARNING, "Failed to get mining notify in initiate_stratum");
|
applog(LOG_WARNING, "Failed to get mining notify in initiate_stratum");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
pool->subscription = (char *)json_string_value(json_array_get(notify_val, 1));
|
pool->subscription = strdup(json_string_value(json_array_get(notify_val, 1)));
|
||||||
if (!pool->subscription) {
|
if (!pool->subscription) {
|
||||||
applog(LOG_WARNING, "Failed to get a subscription in initiate_stratum");
|
applog(LOG_WARNING, "Failed to get a subscription in initiate_stratum");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
pool->nonce1 = (char *)json_string_value(json_array_get(res_val, 1));
|
pool->nonce1 = strdup(json_string_value(json_array_get(res_val, 1)));
|
||||||
if (!pool->nonce1) {
|
if (!pool->nonce1) {
|
||||||
applog(LOG_WARNING, "Failed to get nonce1 in initiate_stratum");
|
applog(LOG_WARNING, "Failed to get nonce1 in initiate_stratum");
|
||||||
goto out;
|
goto out;
|
||||||
@ -1117,18 +1113,18 @@ bool initiate_stratum(struct pool *pool)
|
|||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
out:
|
out:
|
||||||
if (!ret) {
|
if (val)
|
||||||
CLOSESOCKET(pool->sock);
|
json_decref(val);
|
||||||
if (val)
|
|
||||||
json_decref(val);
|
if (ret) {
|
||||||
} else {
|
|
||||||
pool->stratum_active = true;
|
pool->stratum_active = true;
|
||||||
pool->stratum_val = val;
|
pool->stratum_val = val;
|
||||||
if (opt_protocol) {
|
if (opt_protocol) {
|
||||||
applog(LOG_DEBUG, "Pool %d confirmed mining.notify with subscription %s extranonce1 %s extranonce2 %d",
|
applog(LOG_DEBUG, "Pool %d confirmed mining.notify with subscription %s extranonce1 %s extranonce2 %d",
|
||||||
pool->pool_no, pool->subscription, pool->nonce1, pool->nonce2);
|
pool->pool_no, pool->subscription, pool->nonce1, pool->nonce2);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
CLOSESOCKET(pool->sock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user