mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Display X-Reject-Reason, when provided
This commit is contained in:
parent
63777c9d30
commit
f7a9897e13
26
cgminer.c
26
cgminer.c
@ -1418,12 +1418,30 @@ static bool submit_upstream_work(const struct work *work)
|
|||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
|
applog(LOG_DEBUG, "PROOF OF WORK RESULT: false (booooo)");
|
||||||
if (!QUIET) {
|
if (!QUIET) {
|
||||||
|
char wherebuf[17];
|
||||||
|
char *where = wherebuf;
|
||||||
|
char reasonbuf[32];
|
||||||
|
char *reason = reasonbuf;
|
||||||
|
|
||||||
if (total_pools > 1)
|
if (total_pools > 1)
|
||||||
applog(LOG_NOTICE, "Rejected %s %s %d thread %d pool %d",
|
sprintf(where, " pool %d", work->pool->pool_no);
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id, work->pool->pool_no);
|
|
||||||
else
|
else
|
||||||
applog(LOG_NOTICE, "Rejected %s %s %d thread %d",
|
where = "";
|
||||||
hashshow, cgpu->api->name, cgpu->device_id, thr_id);
|
|
||||||
|
res = json_object_get(val, "reject-reason");
|
||||||
|
if (res) {
|
||||||
|
const char *reasontmp = json_string_value(res);
|
||||||
|
size_t reasonLen = strlen(reasontmp);
|
||||||
|
if (reasonLen > 28)
|
||||||
|
reasonLen = 28;
|
||||||
|
reason[0] = ' '; reason[1] = '(';
|
||||||
|
memcpy(2 + reason, reasontmp, reasonLen);
|
||||||
|
reason[reasonLen + 2] = ')'; reason[reasonLen + 3] = '\0';
|
||||||
|
} else
|
||||||
|
reason = "";
|
||||||
|
|
||||||
|
applog(LOG_NOTICE, "Rejected %s %s %d thread %d%s%s",
|
||||||
|
hashshow, cgpu->api->name, cgpu->device_id, thr_id, where, reason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
util.c
9
util.c
@ -57,6 +57,7 @@ struct upload_buffer {
|
|||||||
struct header_info {
|
struct header_info {
|
||||||
char *lp_path;
|
char *lp_path;
|
||||||
bool has_rolltime;
|
bool has_rolltime;
|
||||||
|
char *reason;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tq_ent {
|
struct tq_ent {
|
||||||
@ -232,6 +233,11 @@ static size_t resp_hdr_cb(void *ptr, size_t size, size_t nmemb, void *user_data)
|
|||||||
val = NULL;
|
val = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcasecmp("X-Reject-Reason", key)) {
|
||||||
|
hi->reason = val; /* steal memory reference */
|
||||||
|
val = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(key);
|
free(key);
|
||||||
free(val);
|
free(val);
|
||||||
@ -465,6 +471,9 @@ json_t *json_rpc_call(CURL *curl, const char *url,
|
|||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hi.reason)
|
||||||
|
json_object_set_new(val, "reject-reason", json_string(hi.reason));
|
||||||
|
|
||||||
successful_connect = true;
|
successful_connect = true;
|
||||||
databuf_free(&all_data);
|
databuf_free(&all_data);
|
||||||
curl_slist_free_all(headers);
|
curl_slist_free_all(headers);
|
||||||
|
Loading…
Reference in New Issue
Block a user