|
|
@@ -188,6 +188,7 @@ int icarus_gets(unsigned char *buf, int fd, struct timeval *tv_finish, struct th
|
|
|
ssize_t ret = 0;
|
|
|
int rc = 0;
|
|
|
int epollfd = -1;
|
|
|
+ int epoll_timeout = ICARUS_READ_FAULT_DECISECONDS * 100;
|
|
|
int read_amount = ICARUS_READ_SIZE;
|
|
|
bool first = true;
|
|
|
|
|
|
@@ -197,7 +198,6 @@ int icarus_gets(unsigned char *buf, int fd, struct timeval *tv_finish, struct th
|
|
|
.data.fd = fd,
|
|
|
};
|
|
|
struct epoll_event evr[2];
|
|
|
- int epoll_timeout = ICARUS_READ_FAULT_DECISECONDS * 100;
|
|
|
if (thr && thr->work_restart_notifier[1] != -1) {
|
|
|
epollfd = epoll_create(2);
|
|
|
if (epollfd != -1) {
|
|
|
@@ -258,27 +258,26 @@ int icarus_gets(unsigned char *buf, int fd, struct timeval *tv_finish, struct th
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- rc++;
|
|
|
- if (rc >= read_count) {
|
|
|
+ if (thr && thr->work_restart) {
|
|
|
if (epollfd != -1)
|
|
|
close(epollfd);
|
|
|
if (opt_debug) {
|
|
|
applog(LOG_DEBUG,
|
|
|
- "Icarus Read: No data in %.2f seconds",
|
|
|
- (float)rc/(float)TIME_FACTOR);
|
|
|
+ "Icarus Read: Interrupted by work restart");
|
|
|
}
|
|
|
- return ICA_GETS_TIMEOUT;
|
|
|
+ return ICA_GETS_RESTART;
|
|
|
}
|
|
|
|
|
|
- if (thr && thr->work_restart) {
|
|
|
+ rc++;
|
|
|
+ if (rc >= read_count) {
|
|
|
if (epollfd != -1)
|
|
|
close(epollfd);
|
|
|
if (opt_debug) {
|
|
|
applog(LOG_DEBUG,
|
|
|
- "Icarus Read: Work restart at %.2f seconds",
|
|
|
- (float)(rc)/(float)TIME_FACTOR);
|
|
|
+ "Icarus Read: No data in %.2f seconds",
|
|
|
+ (float)rc * epoll_timeout / 1000.);
|
|
|
}
|
|
|
- return ICA_GETS_RESTART;
|
|
|
+ return ICA_GETS_TIMEOUT;
|
|
|
}
|
|
|
}
|
|
|
}
|