From: Yann Ylavic Date: Tue, 20 Jun 2023 16:04:12 +0000 (+0000) Subject: ab: Add POLLERR and POLLHUP to reqevents for implementations that use/need it. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b82e99aadd132b6e6f433e550739c3edc58fb9df;p=thirdparty%2Fapache%2Fhttpd.git ab: Add POLLERR and POLLHUP to reqevents for implementations that use/need it. Also, apr_pollset_remove() might return APR_NOTFOUND if a connection is reset while being poll()ed, don't treat it as an error. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910519 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/ab.c b/support/ab.c index 087cf8a1798..4372c9cac9d 100644 --- a/support/ab.c +++ b/support/ab.c @@ -599,10 +599,20 @@ static int set_polled_events(struct connection *c, apr_int16_t new_reqevents) { apr_status_t rv; + /* Add POLLHUP and POLLERR to reqevents should some pollset + * implementations need/use them. + */ + if (new_reqevents != 0) { + new_reqevents |= APR_POLLERR; + if (new_reqevents & APR_POLLIN) { + new_reqevents |= APR_POLLHUP; + } + } + if (c->pollfd.reqevents != new_reqevents) { if (c->pollfd.reqevents != 0) { rv = apr_pollset_remove(c->worker->pollset, &c->pollfd); - if (rv != APR_SUCCESS) { + if (rv != APR_SUCCESS && !APR_STATUS_IS_NOTFOUND(rv)) { graceful_strerror("apr_pollset_remove()", rv); return 0; }