mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 18:14:20 +00:00
Do as much outside of mutex locking of sshare_lock as possible.
This commit is contained in:
parent
7551b88d00
commit
7e8019acdd
10
cgminer.c
10
cgminer.c
@ -3156,17 +3156,19 @@ static void *submit_work_thread(void *userdata)
|
|||||||
sshare->sshare_time = time(NULL);
|
sshare->sshare_time = time(NULL);
|
||||||
/* This work item is freed in parse_stratum_response */
|
/* This work item is freed in parse_stratum_response */
|
||||||
sshare->work = work;
|
sshare->work = work;
|
||||||
|
nonce = *((uint32_t *)(work->data + 76));
|
||||||
|
noncehex = bin2hex((const unsigned char *)&nonce, 4);
|
||||||
|
memset(s, 0, 1024);
|
||||||
|
h32 = hash32[6];
|
||||||
|
|
||||||
mutex_lock(&sshare_lock);
|
mutex_lock(&sshare_lock);
|
||||||
/* Give the stratum share a unique id */
|
/* Give the stratum share a unique id */
|
||||||
sshare->id = swork_id++;
|
sshare->id = swork_id++;
|
||||||
HASH_ADD_INT(stratum_shares, id, sshare);
|
HASH_ADD_INT(stratum_shares, id, sshare);
|
||||||
nonce = *((uint32_t *)(work->data + 76));
|
|
||||||
noncehex = bin2hex((const unsigned char *)&nonce, 4);
|
|
||||||
memset(s, 0, 1024);
|
|
||||||
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
|
sprintf(s, "{\"params\": [\"%s\", \"%s\", \"%s\", \"%s\", \"%s\"], \"id\": %d, \"method\": \"mining.submit\"}",
|
||||||
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
|
pool->rpc_user, work->job_id, work->nonce2, work->ntime, noncehex, sshare->id);
|
||||||
h32 = hash32[6];
|
|
||||||
mutex_unlock(&sshare_lock);
|
mutex_unlock(&sshare_lock);
|
||||||
|
|
||||||
free(noncehex);
|
free(noncehex);
|
||||||
|
|
||||||
applog(LOG_INFO, "Submitting share %08lx to pool %d", h32, pool->pool_no);
|
applog(LOG_INFO, "Submitting share %08lx to pool %d", h32, pool->pool_no);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user