mirror of
https://github.com/xmrig/xmrig.git
synced 2024-11-05 16:07:42 +00:00
Show errors from pool.
This commit is contained in:
parent
20061e1b8b
commit
187c7680cc
1 changed files with 17 additions and 4 deletions
15
stratum.c
15
stratum.c
|
@ -238,6 +238,12 @@ bool stratum_handle_response(char *buf) {
|
||||||
json_t *id_val = json_object_get(val, "id");
|
json_t *id_val = json_object_get(val, "id");
|
||||||
|
|
||||||
if (!id_val || json_is_null(id_val) || !res_val) {
|
if (!id_val || json_is_null(id_val) || !res_val) {
|
||||||
|
const char* message;
|
||||||
|
|
||||||
|
if (json_is_object(err_val) && (message = json_string_value(json_object_get(err_val, "message")))) {
|
||||||
|
applog(LOG_ERR, "error: \"%s\"", message);
|
||||||
|
}
|
||||||
|
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +294,6 @@ bool stratum_keepalived(struct stratum_ctx *sctx)
|
||||||
bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass)
|
bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *pass)
|
||||||
{
|
{
|
||||||
char *sret;
|
char *sret;
|
||||||
json_error_t err;
|
|
||||||
|
|
||||||
char *req = malloc(128 + strlen(user) + strlen(pass));
|
char *req = malloc(128 + strlen(user) + strlen(pass));
|
||||||
sprintf(req, "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s/%s\"},\"id\":1}", user, pass, APP_NAME, APP_VERSION);
|
sprintf(req, "{\"method\":\"login\",\"params\":{\"login\":\"%s\",\"pass\":\"%s\",\"agent\":\"%s/%s\"},\"id\":1}", user, pass, APP_NAME, APP_VERSION);
|
||||||
|
@ -324,7 +329,15 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p
|
||||||
json_t *error = json_object_get(val, "error");
|
json_t *error = json_object_get(val, "error");
|
||||||
|
|
||||||
if (!result || json_is_false(result) || (error && !json_is_null(error))) {
|
if (!result || json_is_false(result) || (error && !json_is_null(error))) {
|
||||||
|
const char* message;
|
||||||
|
|
||||||
|
if (json_is_object(error) && (message = json_string_value(json_object_get(error, "message")))) {
|
||||||
|
applog(LOG_ERR, "Stratum authentication failed: \"%s\"", message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
applog(LOG_ERR, "Stratum authentication failed");
|
applog(LOG_ERR, "Stratum authentication failed");
|
||||||
|
}
|
||||||
|
|
||||||
json_decref(val);
|
json_decref(val);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue