Fix POLLERR usage

This commit is contained in:
Sergey Lyubka committed 2022-07-04 18:25:13 +01:00
1 parent e4a5296fbf
commit 543b4a132b
2 files changed
+2 -8

No files matched your search

+1 -4
View File
@@ -4377,7 +4377,6 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
ms = 1; // Don't wait if TLS is ready ms = 1; // Don't wait if TLS is ready
} else { } else {
fds[n].fd = FD(c); fds[n].fd = FD(c);
fds[n].events = POLLERR;
if (can_read(c)) fds[n].events |= POLLIN; if (can_read(c)) fds[n].events |= POLLIN;
if (can_write(c)) fds[n].events |= POLLOUT; if (can_write(c)) fds[n].events |= POLLOUT;
n++; n++;
@@ -4402,9 +4401,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
mg_error(c, "socket error"); mg_error(c, "socket error");
} else { } else {
c->is_readable = c->is_readable =
(unsigned) (fds[n].revents & POLLIN || fds[n].revents & POLLHUP (unsigned) (fds[n].revents & (POLLIN | POLLHUP) ? 1 : 0);
? 1
: 0);
c->is_writable = (unsigned) (fds[n].revents & POLLOUT ? 1 : 0); c->is_writable = (unsigned) (fds[n].revents & POLLOUT ? 1 : 0);
} }
n++; n++;
+1 -4
View File
@@ -532,7 +532,6 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
ms = 1; // Don't wait if TLS is ready ms = 1; // Don't wait if TLS is ready
} else { } else {
fds[n].fd = FD(c); fds[n].fd = FD(c);
fds[n].events = POLLERR;
if (can_read(c)) fds[n].events |= POLLIN; if (can_read(c)) fds[n].events |= POLLIN;
if (can_write(c)) fds[n].events |= POLLOUT; if (can_write(c)) fds[n].events |= POLLOUT;
n++; n++;
@@ -557,9 +556,7 @@ static void mg_iotest(struct mg_mgr *mgr, int ms) {
mg_error(c, "socket error"); mg_error(c, "socket error");
} else { } else {
c->is_readable = c->is_readable =
(unsigned) (fds[n].revents & POLLIN || fds[n].revents & POLLHUP (unsigned) (fds[n].revents & (POLLIN | POLLHUP) ? 1 : 0);
? 1
: 0);
c->is_writable = (unsigned) (fds[n].revents & POLLOUT ? 1 : 0); c->is_writable = (unsigned) (fds[n].revents & POLLOUT ? 1 : 0);
} }
n++; n++;