Browse Source

Remove all static work structs, using the make and free functions.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
73671ab360
  1. 14
      cgminer.c

14
cgminer.c

@ -4737,14 +4737,13 @@ static void *stratum_thread(void *userdata)
applog(LOG_INFO, "Unknown stratum msg: %s", s); applog(LOG_INFO, "Unknown stratum msg: %s", s);
free(s); free(s);
if (pool->swork.clean) { if (pool->swork.clean) {
struct work work; struct work *work = make_work();
memset(&work, 0, sizeof(work));
/* Generate a single work item to update the current /* Generate a single work item to update the current
* block database */ * block database */
pool->swork.clean = false; pool->swork.clean = false;
gen_stratum_work(pool, &work); gen_stratum_work(pool, work);
if (test_work_current(&work)) { if (test_work_current(work)) {
/* Only accept a work restart if this stratum /* Only accept a work restart if this stratum
* connection is from the current pool */ * connection is from the current pool */
if (pool == current_pool()) { if (pool == current_pool()) {
@ -4753,8 +4752,8 @@ static void *stratum_thread(void *userdata)
} }
} else } else
applog(LOG_NOTICE, "Stratum from pool %d detected new block", pool->pool_no); applog(LOG_NOTICE, "Stratum from pool %d detected new block", pool->pool_no);
free_work(work);
} }
} }
out: out:
@ -5936,8 +5935,8 @@ static bool pool_getswork(struct pool *pool)
gettimeofday(&tv_getwork_reply, NULL); gettimeofday(&tv_getwork_reply, NULL);
if (val) { if (val) {
struct work work; struct work *work = make_work();
bool rc = work_decode(pool, &work, val); bool rc = work_decode(pool, work, val);
if (rc) { if (rc) {
applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s", 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); pool->pool_no, pool->rpc_url);
} }
json_decref(val); json_decref(val);
free_work(work);
} else { } else {
applog(LOG_DEBUG, "FAILED to retrieve pool_getswork work from pool %u %s", applog(LOG_DEBUG, "FAILED to retrieve pool_getswork work from pool %u %s",
pool->pool_no, pool->rpc_url); pool->pool_no, pool->rpc_url);

Loading…
Cancel
Save