if (errno == EINTR) {
continue;
}
- else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS) {
+ else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) {
/* EINPROGRESS might happen with non blocking socket,
especially with TCP Fast Open */
if (totalTimeout <= 0 && idleTimeout <= 0) {
throw FDMultiplexerException("poll returned error: " + stringerror());
for(const auto& pollfd : pollfds) {
- if (pollfd.revents == POLLIN || pollfd.revents == POLLOUT) {
+ if (pollfd.revents & POLLIN || pollfd.revents & POLLOUT) {
fds.push_back(pollfd.fd);
}
}
d_inrun=true;
for(const auto& pollfd : pollfds) {
- if(pollfd.revents == POLLIN) {
+ if(pollfd.revents & POLLIN) {
d_iter=d_readCallbacks.find(pollfd.fd);
if(d_iter != d_readCallbacks.end()) {
continue; // so we don't refind ourselves as writable!
}
}
- else if(pollfd.revents == POLLOUT) {
+ else if(pollfd.revents & POLLOUT) {
d_iter=d_writeCallbacks.find(pollfd.fd);
if(d_iter != d_writeCallbacks.end()) {
int sock=-1;
for(const pollfd& pfd : d_prfds) {
- if(pfd.revents == POLLIN) {
+ if(pfd.revents & POLLIN) {
sock = pfd.fd;
remote.sin4.sin_family = AF_INET6;
addrlen=remote.getSocklen();
conn.send(struct.pack("!H", 65535))
count = 0
- while count < (self._maxTCPConnDuration * 2):
+ while count < (self._maxTCPConnDuration * 20):
try:
# sleeping for only one second keeps us below the
# idle timeout (setTCPRecvTimeout())
- time.sleep(1)
+ time.sleep(0.1)
conn.send(b'A')
count = count + 1
except Exception as e:
end = time.time()
- self.assertAlmostEquals(count, self._maxTCPConnDuration, delta=2)
+ self.assertAlmostEquals(count / 10, self._maxTCPConnDuration, delta=2)
self.assertAlmostEquals(end - start, self._maxTCPConnDuration, delta=2)
conn.close()