fix timeouts for mh_execm filters
This commit is contained in:
+15
-1
@@ -907,8 +907,22 @@ int ExecCmd::getline(string& data)
|
||||
}
|
||||
const int BS = 1024;
|
||||
char buf[BS];
|
||||
int n = con->getline(buf, BS);
|
||||
int timeosecs = m->m_timeoutMs / 1000;
|
||||
if (timeosecs == 0)
|
||||
timeosecs = 1;
|
||||
|
||||
// Note that we only go once through here, except in case of
|
||||
// timeout, which is why I think that the goto is more expressive
|
||||
// than a loop
|
||||
again:
|
||||
int n = con->getline(buf, BS, timeosecs);
|
||||
if (n < 0) {
|
||||
if (con->timedout()) {
|
||||
LOGDEB(("ExecCmd::getline: timeout\n"));
|
||||
if (m->m_advise)
|
||||
m->m_advise->newData(0);
|
||||
goto again;
|
||||
}
|
||||
LOGERR(("ExecCmd::getline: error\n"));
|
||||
} else if (n > 0) {
|
||||
data.append(buf, n);
|
||||
|
||||
@@ -117,8 +117,7 @@ int Netcon::select1(int fd, int timeo, int write)
|
||||
ret = select(fd+1, &rd, 0, 0, &tv);
|
||||
}
|
||||
if (!FD_ISSET(fd, &rd)) {
|
||||
LOGERR(("Netcon::select1: fd not ready after select ??\n"));
|
||||
return -1;
|
||||
LOGDEB2(("Netcon::select1: fd %d timeout\n",fd));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user