mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-23 04:54:26 +00:00
Remove all static work structs, using the make and free functions.
This commit is contained in:
parent
3ab92ef6ad
commit
73671ab360
14
cgminer.c
14
cgminer.c
@ -4737,14 +4737,13 @@ static void *stratum_thread(void *userdata)
|
||||
applog(LOG_INFO, "Unknown stratum msg: %s", s);
|
||||
free(s);
|
||||
if (pool->swork.clean) {
|
||||
struct work work;
|
||||
memset(&work, 0, sizeof(work));
|
||||
struct work *work = make_work();
|
||||
|
||||
/* Generate a single work item to update the current
|
||||
* block database */
|
||||
pool->swork.clean = false;
|
||||
gen_stratum_work(pool, &work);
|
||||
if (test_work_current(&work)) {
|
||||
gen_stratum_work(pool, work);
|
||||
if (test_work_current(work)) {
|
||||
/* Only accept a work restart if this stratum
|
||||
* connection is from the current pool */
|
||||
if (pool == current_pool()) {
|
||||
@ -4753,8 +4752,8 @@ static void *stratum_thread(void *userdata)
|
||||
}
|
||||
} else
|
||||
applog(LOG_NOTICE, "Stratum from pool %d detected new block", pool->pool_no);
|
||||
free_work(work);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
out:
|
||||
@ -5936,8 +5935,8 @@ static bool pool_getswork(struct pool *pool)
|
||||
gettimeofday(&tv_getwork_reply, NULL);
|
||||
|
||||
if (val) {
|
||||
struct work work;
|
||||
bool rc = work_decode(pool, &work, val);
|
||||
struct work *work = make_work();
|
||||
bool rc = work_decode(pool, work, val);
|
||||
|
||||
if (rc) {
|
||||
applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s",
|
||||
@ -5949,6 +5948,7 @@ static bool pool_getswork(struct pool *pool)
|
||||
pool->pool_no, pool->rpc_url);
|
||||
}
|
||||
json_decref(val);
|
||||
free_work(work);
|
||||
} else {
|
||||
applog(LOG_DEBUG, "FAILED to retrieve pool_getswork work from pool %u %s",
|
||||
pool->pool_no, pool->rpc_url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user