FreeBSD/contrib/serf/outgoing.c
/* Update the pollset for this connection. We tweak the pollset based on
 * whether we want to read and/or write, given conditions within the
 * connection. If the connection is not (yet) in the pollset, then it
 * will be added.
 */
Update the pollset for this connection. We tweak the pollset based on
whether we want to read and/or write, given conditions within the
connection. If the connection is not (yet) in the pollset, then it
will be added.
Update the pollset for this connection . We tweak the pollset based on whether we want to read and / or write given conditions within the connection . If the connection is not ( yet ) in the pollset then it will be added .
apr_status_t serf__conn_update_pollset(serf_connection_t *conn)
{
    serf_context_t *ctx = conn->ctx;
    apr_status_t status;
    apr_pollfd_t desc = { 0 };
    if (!conn->skt) {
        return APR_SUCCESS;
    }
    desc.desc_type = APR_POLL_SOCKET;
    desc.desc.s = conn->skt;
    desc.reqevents = conn->reqevents;
    status = ctx->pollset_rm(ctx->pollset_baton,
                             &desc, conn);
    if (status && !APR_STATUS_IS_NOTFOUND(status))
        return status;
    desc.reqevents = APR_POLLHUP | APR_POLLERR;
    if (conn->requests &&
        conn->state != SERF_CONN_INIT) {
        desc.reqevents |= APR_POLLIN;
        if (conn->stop_writing != 1) {
            if (conn->vec_len &&
                conn->state != SERF_CONN_CLOSING)
                desc.reqevents |= APR_POLLOUT;
            else {
                if ((conn->probable_keepalive_limit &&
                     conn->completed_requests > conn->probable_keepalive_limit) ||
                    (conn->max_outstanding_requests &&
                     conn->completed_requests - conn->completed_responses >=
                     conn->max_outstanding_requests)) {
                }
                else if (request_or_data_pending(NULL, conn)) {
                    desc.reqevents |= APR_POLLOUT;
                }
            }
        }
    }
    if (conn->async_responses) {
        desc.reqevents |= APR_POLLIN;
    }
    conn->reqevents = desc.reqevents;
    return ctx->pollset_add(ctx->pollset_baton,
                            &desc, &conn->baton);
}
apr_status_t serf__conn_update_pollset ( serf_connection_t * conn ) { serf_context_t * ctx = conn -> ctx ; apr_status_t status ; apr_pollfd_t desc = { 0 } ; if ( ! conn -> skt ) { return APR_SUCCESS ; } desc . desc_type = APR_POLL_SOCKET ; desc . desc . s = conn -> skt ; desc . reqevents = conn -> reqevents ; status = ctx -> pollset_rm ( ctx -> pollset_baton , & desc , conn ) ; if ( status && ! APR_STATUS_IS_NOTFOUND ( status ) ) return status ; desc . reqevents = APR_POLLHUP | APR_POLLERR ; if ( conn -> requests && conn -> state != SERF_CONN_INIT ) { desc . reqevents |= APR_POLLIN ; if ( conn -> stop_writing != 1 ) { if ( conn -> vec_len && conn -> state != SERF_CONN_CLOSING ) desc . reqevents |= APR_POLLOUT ; else { if ( ( conn -> probable_keepalive_limit && conn -> completed_requests > conn -> probable_keepalive_limit ) || ( conn -> max_outstanding_requests && conn -> completed_requests - conn -> completed_responses >= conn -> max_outstanding_requests ) ) { } else if ( request_or_data_pending ( NULL , conn ) ) { desc . reqevents |= APR_POLLOUT ; } } } } if ( conn -> async_responses ) { desc . reqevents |= APR_POLLIN ; } conn -> reqevents = desc . reqevents ; return ctx -> pollset_add ( ctx -> pollset_baton , & desc , & conn -> baton ) ; }
Update the pollset for this connection.
Update the pollset for this connection .
/* Remove the socket from the poll set. */ /* Now put it back in with the correct read/write values. */ /* If there are any outstanding events, then we want to read. */ /* ### not true. we only want to read IF we have sent some data */ /* Don't write if OpenSSL told us that it needs to read data first. */ /* If the connection is not closing down and
             *   has unwritten data or
             *   there are any requests that still have buckets to write out,
             *     then we want to write.
             */ /* we wouldn't try to write any way right now. */ /* If we can have async responses, always look for something to read. */ /* save our reqevents, so we can pass it in to remove later. */ /* Note: even if we don't want to read/write this socket, we still
     * want to poll it for hangups and errors.
     */