]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
ab: Add POLLERR and POLLHUP to reqevents for implementations that use/need it.
authorYann Ylavic <ylavic@apache.org>
Tue, 20 Jun 2023 16:04:12 +0000 (16:04 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 20 Jun 2023 16:04:12 +0000 (16:04 +0000)
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

support/ab.c

index 087cf8a17988d184810cc50e90fe1cc9e63eb182..4372c9cac9d3b4c1caf22b8c9b4c5185477b44c9 100644 (file)
@@ -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;
             }