*) ab: Fix maintenance of the pollset to resolve EALREADY errors
with kqueue (BSD/OS X) and excessive CPU with event ports (Solaris).
- PR 44584. [Jeff Trawick]
+ PR 44584. Use APR_POLLSET_NOCOPY for better performance with some
+ pollset implementations. [Jeff Trawick]
*) mod_disk_cache: The module now turns off sendfile support if
'EnableSendfile off' is defined globally. [Lars Eilebrecht]
struct connection {
apr_pool_t *ctx;
apr_socket_t *aprsock;
+ apr_pollfd_t pollfd;
int state;
apr_size_t read; /* amount of bytes read */
apr_size_t bread; /* amount of body read */
done; /* Connection closed */
int socknum;
- apr_int16_t reqevents; /* current poll events for this socket */
#ifdef USE_SSL
SSL *ssl;
#endif
static void set_polled_events(struct connection *c, apr_int16_t new_reqevents)
{
- apr_int16_t old_reqevents = c->reqevents;
- apr_pollfd_t pfd;
apr_status_t rv;
- if (old_reqevents != new_reqevents) {
- pfd.desc_type = APR_POLL_SOCKET;
- pfd.desc.s = c->aprsock;
- pfd.client_data = c;
-
- if (old_reqevents != 0) {
- pfd.reqevents = old_reqevents;
- rv = apr_pollset_remove(readbits, &pfd);
+ if (c->pollfd.reqevents != new_reqevents) {
+ if (c->pollfd.reqevents != 0) {
+ rv = apr_pollset_remove(readbits, &c->pollfd);
if (rv != APR_SUCCESS) {
apr_err("apr_pollset_remove()", rv);
}
}
if (new_reqevents != 0) {
- pfd.reqevents = new_reqevents;
- rv = apr_pollset_add(readbits, &pfd);
+ c->pollfd.reqevents = new_reqevents;
+ rv = apr_pollset_add(readbits, &c->pollfd);
if (rv != APR_SUCCESS) {
apr_err("apr_pollset_add()", rv);
}
}
-
- c->reqevents = new_reqevents;
}
}
SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) {
apr_err("socket", rv);
}
+
+ c->pollfd.desc_type = APR_POLL_SOCKET;
+ c->pollfd.desc.s = c->aprsock;
+ c->pollfd.reqevents = 0;
+ c->pollfd.client_data = c;
+
if ((rv = apr_socket_opt_set(c->aprsock, APR_SO_NONBLOCK, 1))
!= APR_SUCCESS) {
apr_err("socket nonblock", rv);
stats = calloc(requests, sizeof(struct data));
- if ((status = apr_pollset_create(&readbits, concurrency, cntxt, 0)) != APR_SUCCESS) {
+ if ((status = apr_pollset_create(&readbits, concurrency, cntxt,
+ APR_POLLSET_NOCOPY)) != APR_SUCCESS) {
apr_err("apr_pollset_create failed", status);
}