svn commit: r419646 - in head/devel/apr1: . files
Olli Hauer
ohauer at FreeBSD.org
Thu Aug 4 18:44:23 UTC 2016
Author: ohauer
Date: Thu Aug 4 18:44:21 2016
New Revision: 419646
URL: https://svnweb.freebsd.org/changeset/ports/419646
Log:
- add patch to modify apr1 poll() emulation to match behavior expected by serf
serf depends on the poll emulation in apr returning a POLLERR event if a
non-blocking connect() attempt fails in order to trigger an IPv6 -> IPv4
fallback, or a fallback to another address for a multi-homed host. On
FreeBSD, the poll emulation is done using kqueue, and the result returned by
the poll() emulation is POLLIN + POLLHUP.
- upstream apache PR:
https://bz.apache.org/bugzilla/show_bug.cgi?id=59914
PR: 211430
Submitted by: Don Lewis (truckman@)
MFH: 2016Q3
Added:
head/devel/apr1/files/patch-apr_poll_unix_kqueue.c (contents, props changed)
Modified:
head/devel/apr1/Makefile
Modified: head/devel/apr1/Makefile
==============================================================================
--- head/devel/apr1/Makefile Thu Aug 4 18:25:04 2016 (r419645)
+++ head/devel/apr1/Makefile Thu Aug 4 18:44:21 2016 (r419646)
@@ -3,6 +3,7 @@
PORTNAME= apr
PORTVERSION= ${APR_VERSION}.${APU_VERSION}
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= APACHE/apr
DISTFILES= apr-${APR_VERSION}.tar.gz \
Added: head/devel/apr1/files/patch-apr_poll_unix_kqueue.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/devel/apr1/files/patch-apr_poll_unix_kqueue.c Thu Aug 4 18:44:21 2016 (r419646)
@@ -0,0 +1,77 @@
+# upstram PR: https://bz.apache.org/bugzilla/show_bug.cgi?id=59914
+# FreeBSD PR: 211430
+========================================================================
+--- apr-1.5.2/poll/unix/kqueue.c.orig 2015-03-20 01:34:07 UTC
++++ apr-1.5.2/poll/unix/kqueue.c
+@@ -25,21 +25,40 @@
+
+ #ifdef HAVE_KQUEUE
+
+-static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags)
++static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags,
++ int fflags, intptr_t data)
+ {
+ apr_int16_t rv = 0;
+
+- if (event == EVFILT_READ)
+- rv |= APR_POLLIN;
+- else if (event == EVFILT_WRITE)
+- rv |= APR_POLLOUT;
+- if (flags & EV_EOF)
+- rv |= APR_POLLHUP;
+- /* APR_POLLPRI, APR_POLLERR, and APR_POLLNVAL are not handled by this
+- * implementation.
++ /* APR_POLLPRI and APR_POLLNVAL are not handled by this implementation.
+ * TODO: See if EV_ERROR + certain system errors in the returned data field
+ * should map to APR_POLLNVAL.
+ */
++ if (event == EVFILT_READ) {
++ if (data > 0 || fflags == 0)
++ rv |= APR_POLLIN;
++ else
++ rv |= APR_POLLERR;
++ /*
++ * Don't return POLLHUP if connect fails. Apparently Linux
++ * does not, and this is expected by serf in order for IPv6 to
++ * IPv4 or multihomed host fallback to work.
++ *
++ * ETIMEDOUT is ambiguous here since we don't know if a
++ * connection was established. We don't want to return
++ * POLLHUP here if the connection attempt timed out, but
++ * we do if the connection was successful but later dropped.
++ * For now, favor the latter.
++ */
++ if ((flags & EV_EOF) != 0 && fflags != ECONNREFUSED &&
++ fflags != ENETUNREACH && fflags != EHOSTUNREACH)
++ rv |= APR_POLLHUP;
++ } else if (event == EVFILT_WRITE) {
++ if (data > 0 || fflags == 0)
++ rv |= APR_POLLOUT;
++ else
++ rv |= APR_POLLERR;
++ }
+ return rv;
+ }
+
+@@ -290,7 +309,9 @@ static apr_status_t impl_pollset_poll(ap
+ pollset->p->result_set[j] = fd;
+ pollset->p->result_set[j].rtnevents =
+ get_kqueue_revent(pollset->p->ke_set[i].filter,
+- pollset->p->ke_set[i].flags);
++ pollset->p->ke_set[i].flags,
++ pollset->p->ke_set[i].fflags,
++ pollset->p->ke_set[i].data);
+ j++;
+ }
+ }
+@@ -471,7 +492,9 @@ static apr_status_t impl_pollcb_poll(apr
+ apr_pollfd_t *pollfd = (apr_pollfd_t *)(pollcb->pollset.ke[i].udata);
+
+ pollfd->rtnevents = get_kqueue_revent(pollcb->pollset.ke[i].filter,
+- pollcb->pollset.ke[i].flags);
++ pollcb->pollset.ke[i].flags,
++ pollcb->pollset.ke[i].fflags,
++ pollcb->pollset.ke[i].data);
+
+ rv = func(baton, pollfd);
+
More information about the svn-ports-all
mailing list