Skip to content

Commit

Permalink
ab: Add POLLERR and POLLHUP to reqevents for implementations that use…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
ylavic committed Jun 20, 2023
1 parent 162a666 commit b82e99a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion support/ab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b82e99a

Please sign in to comment.