On Tue, Aug 31, 2021 at 9:29 AM Ruediger Pluem <rpl...@apache.org> wrote: > > On 8/30/21 8:04 PM, yla...@apache.org wrote: > > > > + /* We want to write if we asked for POLLOUT and got: > > + * - POLLOUT: the socket is ready for write; > > + * - !POLLIN: the socket is in error state (POLLERR) so we let > > + * the user know by failing the write and log, OR the socket > > + * is shutdown for read already (POLLHUP) so we have to > > + * shutdown for write. > > */ > > if ((tc->pfd->reqevents & APR_POLLOUT) > > && ((pfd->rtnevents & APR_POLLOUT) > > + || !(tc->pfd->reqevents & APR_POLLIN) > > Why should we write if we requested POLLOUT did not get POLLOUT back, but did > not request for POLLIN?
What I want to avoid in this loop is to handle all the POLLIN|POLLERR or POLLOUT|POLLERR or POLLERR alone which depend on the system. So it's written such that there is no "blank" pass, when no POLLIN|POLLHUP or POLLOUT is returned (likely an error condition) we will issue either a read or a write (in that order of preference) to catch the error at the core filters' level. This was missing the POLLOUT|POLLHUP case when the socket is shutdown for read already, meaning that we will never get POLLIN anymore, and this is fixed by this !(reqevents & APR_POLLIN) case to issue a write (well a shutdown for write exactly here) when no read is to be issued below. Does it make sense? Regards; Yann.