ASF Bugzilla – Attachment 34082 Details for
Bug 59914
[patch] poll/unix/kqueue.c IPv6 to IPv4 fallback does not work in serf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to modify apr1 poll() emulation to match behavior expected by serf
APR-1.5.2_IPv6-IPv4_kqueue.diff (text/plain), 2.91 KB, created by
ohauer
on 2016-07-31 10:27:53 UTC
(
hide
)
Description:
patch to modify apr1 poll() emulation to match behavior expected by serf
Filename:
MIME Type:
Creator:
ohauer
Created:
2016-07-31 10:27:53 UTC
Size:
2.91 KB
patch
obsolete
>Index: 1.5.2/poll/unix/kqueue.c >=================================================================== >--- 1.5.2/poll/unix/kqueue.c (revision 1754645) >+++ 1.5.2/poll/unix/kqueue.c (working copy) >@@ -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 @@ > 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 @@ > 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); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59914
: 34082