mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +00:00
Add support for client.get_version for stratum.
This commit is contained in:
parent
ca962ee58b
commit
7f522ef83c
19
util.c
19
util.c
@ -1125,6 +1125,21 @@ static bool parse_reconnect(struct pool *pool, json_t *val)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool send_version(struct pool *pool, json_t *val)
|
||||||
|
{
|
||||||
|
char s[RBUFSIZE];
|
||||||
|
int id = json_integer_value(json_object_get(val, "id"));
|
||||||
|
|
||||||
|
if (!id)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
sprintf(s, "{\"id\": %d, \"result\": \""PACKAGE"/"VERSION"\", \"error\": null}", id);
|
||||||
|
if (!stratum_send(pool, s, strlen(s)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool parse_method(struct pool *pool, char *s)
|
bool parse_method(struct pool *pool, char *s)
|
||||||
{
|
{
|
||||||
json_t *val = NULL, *method, *err_val, *params;
|
json_t *val = NULL, *method, *err_val, *params;
|
||||||
@ -1181,6 +1196,10 @@ bool parse_method(struct pool *pool, char *s)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strncasecmp(buf, "client.get_version", 18) && send_version(pool, val)) {
|
||||||
|
ret = true;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
if (val)
|
if (val)
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user