Backport changes from xmrig-aeon.

This commit is contained in:
XMRig 2017-04-30 02:56:47 +03:00
parent 3de7983826
commit caf7cda1d5
4 changed files with 31 additions and 67 deletions

View file

@ -329,18 +329,11 @@ bool stratum_authorize(struct stratum_ctx *sctx, const char *user, const char *p
return false;
}
login_decode(sctx, val);
job(sctx, json_object_get(result, "job"));
// json_t *job = json_object_get(result, "job");
//pthread_mutex_lock(&sctx->work_lock);
//if (job) {
// job_decode(sctx, job);
//}
//pthread_mutex_unlock(&sctx->work_lock);
if (login_decode(sctx, val) && job(sctx, json_object_get(result, "job"))) {
pthread_mutex_lock(&sctx->sock_lock);
sctx->ready = true;
pthread_mutex_unlock(&sctx->sock_lock);
}
json_decref(val);
return true;
@ -609,10 +602,6 @@ static bool login_decode(struct stratum_ctx *sctx, const json_t *val) {
memset(&sctx->id, 0, sizeof(sctx->id));
memcpy(&sctx->id, id, strlen(id));
pthread_mutex_lock(&sctx->sock_lock);
sctx->ready = true;
pthread_mutex_unlock(&sctx->sock_lock);
const char *s = json_string_value(json_object_get(res, "status"));
if (!s) {
applog(LOG_ERR, "JSON invalid status");