rev = c->read;
- if (overflow_list[i].revents & (POLLIN|POLLERR|POLLHUP|POLLNVAL)) {
+ if (rev->active
+ && rev->event_handler
+ && (overflow_list[i].revents
+ & (POLLIN|POLLERR|POLLHUP|POLLNVAL)))
+ {
tested++;
if (ngx_threaded) {
wev = c->write;
- if (overflow_list[i].revents & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)) {
+ if (wev->active
+ && wev->event_handler
+ && (overflow_list[i].revents
+ & (POLLOUT|POLLERR|POLLHUP|POLLNVAL)))
+ {
tested++;
if (ngx_threaded) {