1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Merge pull request #264 from luke-jr/life_init

Bugfix: Don't declare devices SICK if they're just busy initializing
This commit is contained in:
Con Kolivas 2012-07-11 23:00:35 -07:00
commit 96f3a98838
4 changed files with 10 additions and 1 deletions

5
api.c
View File

@ -170,6 +170,7 @@ static const char *APIVERSION = "1.14";
static const char *DEAD = "Dead"; static const char *DEAD = "Dead";
static const char *SICK = "Sick"; static const char *SICK = "Sick";
static const char *NOSTART = "NoStart"; static const char *NOSTART = "NoStart";
static const char *INIT = "Initializing";
static const char *DISABLED = "Disabled"; static const char *DISABLED = "Disabled";
static const char *ALIVE = "Alive"; static const char *ALIVE = "Alive";
static const char *REJECTING = "Rejecting"; static const char *REJECTING = "Rejecting";
@ -1262,6 +1263,8 @@ static void gpustatus(int gpu, bool isjson)
status = (char *)SICK; status = (char *)SICK;
else if (cgpu->status == LIFE_NOSTART) else if (cgpu->status == LIFE_NOSTART)
status = (char *)NOSTART; status = (char *)NOSTART;
else if (cgpu->status == LIFE_INIT)
status = (char *)INIT;
else else
status = (char *)ALIVE; status = (char *)ALIVE;
@ -1361,6 +1364,8 @@ static void pgastatus(int pga, bool isjson)
status = (char *)SICK; status = (char *)SICK;
else if (cgpu->status == LIFE_NOSTART) else if (cgpu->status == LIFE_NOSTART)
status = (char *)NOSTART; status = (char *)NOSTART;
else if (cgpu->status == LIFE_INIT)
status = (char *)INIT;
else else
status = (char *)ALIVE; status = (char *)ALIVE;

View File

@ -4594,6 +4594,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
dev_count_dead = (cgpu->low_count > WATCHDOG_DEAD_COUNT); dev_count_dead = (cgpu->low_count > WATCHDOG_DEAD_COUNT);
if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME) && dev_count_well) { if (cgpu->status != LIFE_WELL && (now.tv_sec - thr->last.tv_sec < WATCHDOG_SICK_TIME) && dev_count_well) {
if (cgpu->status != LIFE_INIT)
applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str); applog(LOG_ERR, "%s: Recovered, declaring WELL!", dev_str);
cgpu->status = LIFE_WELL; cgpu->status = LIFE_WELL;
cgpu->device_last_well = time(NULL); cgpu->device_last_well = time(NULL);
@ -5440,6 +5441,7 @@ begin_bench:
struct cgpu_info *cgpu = devices[i]; struct cgpu_info *cgpu = devices[i];
cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1)); cgpu->thr = malloc(sizeof(*cgpu->thr) * (cgpu->threads+1));
cgpu->thr[cgpu->threads] = NULL; cgpu->thr[cgpu->threads] = NULL;
cgpu->status = LIFE_INIT;
for (j = 0; j < cgpu->threads; ++j, ++k) { for (j = 0; j < cgpu->threads; ++j, ++k) {
thr = &thr_info[k]; thr = &thr_info[k];

View File

@ -639,6 +639,7 @@ retry:
case LIFE_DEAD: case LIFE_DEAD:
wlog("DEAD reported in %s", checkin); wlog("DEAD reported in %s", checkin);
break; break;
case LIFE_INIT:
case LIFE_NOSTART: case LIFE_NOSTART:
wlog("Never started"); wlog("Never started");
break; break;

View File

@ -163,7 +163,8 @@ enum alive {
LIFE_WELL, LIFE_WELL,
LIFE_SICK, LIFE_SICK,
LIFE_DEAD, LIFE_DEAD,
LIFE_NOSTART LIFE_NOSTART,
LIFE_INIT,
}; };