1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00

bflsc add work reply INPROCESS: missing from the spec

This commit is contained in:
Kano 2013-04-26 18:57:40 +10:00
parent 5121163ef2
commit 93e3e8c90e

View File

@ -138,6 +138,7 @@ struct QueueJobStructure {
uint8_t endOfBlock; uint8_t endOfBlock;
}; };
#define QUE_RES_LINES_MIN 3
#define QUE_MIDSTATE 0 #define QUE_MIDSTATE 0
#define QUE_BLOCKDATA 1 #define QUE_BLOCKDATA 1
#define QUE_NONCECOUNT 2 #define QUE_NONCECOUNT 2
@ -1177,50 +1178,65 @@ static int process_results(struct cgpu_info *bflsc, int dev, char *buf, int *non
int que, i, lines, count; int que, i, lines, count;
char xlink[17]; char xlink[17];
bool res; bool res;
char *tmp; char *tmp, *tmp2;
*nonces = 0; *nonces = 0;
res = tolines(bflsc, dev, buf, &lines, &items, C_GETRESULTS);
if (lines < 1) {
que = 0;
goto arigatou;
}
xlinkstr(&(xlink[0]), dev, sc_info); xlinkstr(&(xlink[0]), dev, sc_info);
res = breakdown(ONECOLON, items[0], &count, &firstname, &fields, &lf); res = tolines(bflsc, dev, buf, &lines, &items, C_GETRESULTS);
if (count < 1) { if (lines < 1) {
tmp = str_text(items[0]); tmp = str_text(buf);
applog(LOG_ERR, "%s%i:%s incorrect result header (%s) results ignored", applog(LOG_ERR, "%s%i:%s empty result (%s) ignored",
bflsc->drv->name, bflsc->device_id, xlink, tmp); bflsc->drv->name, bflsc->device_id, xlink, tmp);
free(tmp); free(tmp);
freebreakdown(&count, &firstname, &fields);
que = 0; que = 0;
goto arigatou; goto arigatou;
} }
if (count != 1) { if (lines < QUE_RES_LINES_MIN) {
tmp = str_text(items[0]); tmp = str_text(buf);
applog(LOG_ERR, "%s%i:%s incorrect result header (%s) will try anyway", applog(LOG_ERR, "%s%i:%s result too small (%s) ignored",
bflsc->drv->name, bflsc->device_id, xlink, tmp); bflsc->drv->name, bflsc->device_id, xlink, tmp);
free(tmp); free(tmp);
que = 0;
goto arigatou;
}
res = breakdown(ONECOLON, items[1], &count, &firstname, &fields, &lf);
if (count < 1) {
tmp = str_text(buf);
tmp2 = str_text(items[1]);
applog(LOG_ERR, "%s%i:%s empty result count (%s) in (%s) will try anyway",
bflsc->drv->name, bflsc->device_id, xlink, tmp2, tmp);
free(tmp2);
free(tmp);
} else if (count != 1) {
tmp = str_text(buf);
tmp2 = str_text(items[1]);
applog(LOG_ERR, "%s%i:%s incorrect result count (%s) in (%s) will try anyway",
bflsc->drv->name, bflsc->device_id, xlink, tmp2, tmp);
free(tmp2);
free(tmp);
} }
que = atoi(fields[0]); que = atoi(fields[0]);
if (que != (lines - 2)) { if (que != (lines - QUE_RES_LINES_MIN)) {
i = que;
// 1+ In case the last line isn't 'OK' - try to process it
que = 1 + lines - QUE_RES_LINES_MIN;
tmp = str_text(items[0]); tmp = str_text(items[0]);
applog(LOG_ERR, "%s%i:%s incorrect result header (%s) %d but should be %d will try %d anyway", applog(LOG_ERR, "%s%i:%s incorrect result count (%s) %d but should be %d will try %d anyway",
bflsc->drv->name, bflsc->device_id, xlink, tmp, que, lines - 2, lines - 2); bflsc->drv->name, bflsc->device_id, xlink, tmp, i, que, que);
free(tmp); free(tmp);
que = lines - 2;
} }
freebreakdown(&count, &firstname, &fields); freebreakdown(&count, &firstname, &fields);
for (i = 1; i <= que; i++) { for (i = 0; i < que; i++) {
res = breakdown(NOCOLON, items[i], &count, &firstname, &fields, &lf); res = breakdown(NOCOLON, items[i + QUE_RES_LINES_MIN - 1], &count, &firstname, &fields, &lf);
process_nonces(bflsc, dev, &(xlink[0]), items[i], count, fields, nonces); process_nonces(bflsc, dev, &(xlink[0]), items[i], count, fields, nonces);
freebreakdown(&count, &firstname, &fields); freebreakdown(&count, &firstname, &fields);
} }