Skip to content

Commit

Permalink
ab: Follow up to r1910912: No need for the "events" member.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1911175 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ylavic committed Jul 21, 2023
1 parent 349566f commit a2305b4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions support/ab.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ struct connection {
apr_pool_t *ctx;
apr_socket_t *aprsock;
apr_pollfd_t pollfd;
apr_int16_t events;
int state;
apr_time_t delay;
apr_size_t read; /* amount of bytes read */
Expand Down Expand Up @@ -650,6 +649,7 @@ static int set_polled_events(struct connection *c, apr_int16_t new_reqevents)
rv = apr_pollset_add(c->worker->pollset, &c->pollfd);
if (rv != APR_SUCCESS) {
graceful_strerror("apr_pollset_add()", rv);
c->pollfd.reqevents = 0;
return 0;
}
c->worker->polls++;
Expand All @@ -661,19 +661,17 @@ static int set_polled_events(struct connection *c, apr_int16_t new_reqevents)
static void set_conn_state(struct connection *c, conn_state_e state,
apr_int16_t events)
{
struct worker *worker = c->worker;
int (*const counters)[2] = c->worker->counters;

assert(worker->counters[c->state][(c->events & APR_POLLOUT) != 0] > 0);
worker->counters[c->state][(c->events & APR_POLLOUT) != 0]--;
assert(counters[c->state][(c->pollfd.reqevents & APR_POLLOUT) != 0] > 0);
counters[c->state][(c->pollfd.reqevents & APR_POLLOUT) != 0]--;

c->state = state;
c->events = events;
if (!set_polled_events(c, events) && state != STATE_DISCONNECTED) {
close_connection(c);
c->events = 0;
}

worker->counters[c->state][(c->events & APR_POLLOUT) != 0]++;
counters[c->state][(c->pollfd.reqevents & APR_POLLOUT) != 0]++;
}

/* --------------------------------------------------------- */
Expand Down

0 comments on commit a2305b4

Please sign in to comment.