mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Show error codes on select and read fail in avalon.
This commit is contained in:
parent
5e3474b0c8
commit
c6b9a3eeea
@ -223,12 +223,16 @@ static inline int avalon_gets(int fd, uint8_t *buf, struct thr_info *thr,
|
|||||||
FD_ZERO(&rd);
|
FD_ZERO(&rd);
|
||||||
FD_SET(fd, &rd);
|
FD_SET(fd, &rd);
|
||||||
ret = select(fd + 1, &rd, NULL, NULL, &timeout);
|
ret = select(fd + 1, &rd, NULL, NULL, &timeout);
|
||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0)) {
|
||||||
|
applog(LOG_ERR, "Avalon: Error %d on select in avalon_gets", errno);
|
||||||
return AVA_GETS_ERROR;
|
return AVA_GETS_ERROR;
|
||||||
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret = read(fd, buf, read_amount);
|
ret = read(fd, buf, read_amount);
|
||||||
if (unlikely(ret < 0))
|
if (unlikely(ret < 0)) {
|
||||||
|
applog(LOG_ERR, "Avalon: Error %d on read in avalon_gets", errno);
|
||||||
return AVA_GETS_ERROR;
|
return AVA_GETS_ERROR;
|
||||||
|
}
|
||||||
if (likely(first)) {
|
if (likely(first)) {
|
||||||
gettimeofday(tv_finish, NULL);
|
gettimeofday(tv_finish, NULL);
|
||||||
first = false;
|
first = false;
|
||||||
@ -307,7 +311,7 @@ static void avalon_get_reset(int fd, struct avalon_result *ar)
|
|||||||
FD_SET(fd, &rd);
|
FD_SET(fd, &rd);
|
||||||
ret = select(fd + 1, &rd, NULL, NULL, &timeout);
|
ret = select(fd + 1, &rd, NULL, NULL, &timeout);
|
||||||
if (unlikely(ret < 0)) {
|
if (unlikely(ret < 0)) {
|
||||||
applog(LOG_WARNING, "Avalon: Error on select in avalon_get_reset");
|
applog(LOG_WARNING, "Avalon: Error %d on select in avalon_get_reset", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
@ -316,7 +320,7 @@ static void avalon_get_reset(int fd, struct avalon_result *ar)
|
|||||||
}
|
}
|
||||||
ret = read(fd, result, read_amount);
|
ret = read(fd, result, read_amount);
|
||||||
if (unlikely(ret != read_amount)) {
|
if (unlikely(ret != read_amount)) {
|
||||||
applog(LOG_WARNING, "Avalon: Error on read in avalon_get_reset");
|
applog(LOG_WARNING, "Avalon: Error %d on read in avalon_get_reset", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (opt_debug) {
|
if (opt_debug) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user