mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 03:24:26 +00:00
sshare could have already been free'd by parse_stratum_response in stratum_rthread by the point we reach this code - possible segfault fixed
This commit is contained in:
parent
2d23a7d634
commit
04722e2517
22
sgminer.c
22
sgminer.c
@ -5451,14 +5451,23 @@ static void *stratum_sthread(void *userdata)
|
||||
bool sessionid_match;
|
||||
|
||||
if (likely(stratum_send(pool, s, strlen(s)))) {
|
||||
if (pool_tclear(pool, &pool->submit_fail))
|
||||
applog(LOG_WARNING, "%s communication resumed, submitting work", get_pool_name(pool));
|
||||
int ssdiff;
|
||||
|
||||
sshare->sshare_sent = time(NULL);
|
||||
ssdiff = sshare->sshare_sent - sshare->sshare_time;
|
||||
if (opt_debug || ssdiff > 0) {
|
||||
applog(LOG_INFO, "Pool %d stratum share submission lag time %d seconds",
|
||||
pool->pool_no, ssdiff);
|
||||
}
|
||||
|
||||
mutex_lock(&sshare_lock);
|
||||
HASH_ADD_INT(stratum_shares, id, sshare);
|
||||
pool->sshares++;
|
||||
mutex_unlock(&sshare_lock);
|
||||
|
||||
if (pool_tclear(pool, &pool->submit_fail))
|
||||
applog(LOG_WARNING, "%s communication resumed, submitting work", get_pool_name(pool));
|
||||
|
||||
applog(LOG_DEBUG, "Successfully submitted, adding to stratum_shares db");
|
||||
submitted = true;
|
||||
break;
|
||||
@ -5492,15 +5501,6 @@ static void *stratum_sthread(void *userdata)
|
||||
free(sshare);
|
||||
pool->stale_shares++;
|
||||
total_stale++;
|
||||
} else {
|
||||
int ssdiff;
|
||||
|
||||
sshare->sshare_sent = time(NULL);
|
||||
ssdiff = sshare->sshare_sent - sshare->sshare_time;
|
||||
if (opt_debug || ssdiff > 0) {
|
||||
applog(LOG_INFO, "Pool %d stratum share submission lag time %d seconds",
|
||||
pool->pool_no, ssdiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user