您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ APR_BRIGADE_EMPTY函数代码示例

51自学网 2021-06-01 19:35:32
  C++
这篇教程C++ APR_BRIGADE_EMPTY函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中APR_BRIGADE_EMPTY函数的典型用法代码示例。如果您正苦于以下问题:C++ APR_BRIGADE_EMPTY函数的具体用法?C++ APR_BRIGADE_EMPTY怎么用?C++ APR_BRIGADE_EMPTY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了APR_BRIGADE_EMPTY函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CaseFilterInFilter

static apr_status_t CaseFilterInFilter(ap_filter_t *f,                                       apr_bucket_brigade *pbbOut,                                       ap_input_mode_t eMode,                                       apr_read_type_e eBlock,                                       apr_off_t nBytes){    request_rec *r = f->r;    conn_rec *c = r->connection;    CaseFilterInContext *pCtx;    apr_status_t ret;    if (!(pCtx = f->ctx)) {        f->ctx = pCtx = apr_palloc(r->pool, sizeof *pCtx);        pCtx->pbbTmp = apr_brigade_create(r->pool, c->bucket_alloc);    }    if (APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {        ret = ap_get_brigade(f->next, pCtx->pbbTmp, eMode, eBlock, nBytes);        if (eMode == AP_MODE_EATCRLF || ret != APR_SUCCESS)            return ret;    }    while (!APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {        apr_bucket *pbktIn = APR_BRIGADE_FIRST(pCtx->pbbTmp);        apr_bucket *pbktOut;        const char *data;        apr_size_t len;        char *buf;        apr_size_t n;        /* It is tempting to do this...         * APR_BUCKET_REMOVE(pB);         * APR_BRIGADE_INSERT_TAIL(pbbOut,pB);         * and change the case of the bucket data, but that would be wrong         * for a file or socket buffer, for example...         */        if (APR_BUCKET_IS_EOS(pbktIn)) {            APR_BUCKET_REMOVE(pbktIn);            APR_BRIGADE_INSERT_TAIL(pbbOut, pbktIn);            break;        }        ret=apr_bucket_read(pbktIn, &data, &len, eBlock);        if (ret != APR_SUCCESS)            return ret;        buf = ap_malloc(len);        for (n=0 ; n < len ; ++n) {            buf[n] = apr_toupper(data[n]);        }        pbktOut = apr_bucket_heap_create(buf, len, 0, c->bucket_alloc);        APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);        apr_bucket_delete(pbktIn);    }    return APR_SUCCESS;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:60,


示例2: h2_beam_send

apr_status_t h2_beam_send(h2_bucket_beam *beam,                           apr_bucket_brigade *red_brigade,                           apr_read_type_e block){    apr_bucket *bred;    apr_status_t status = APR_SUCCESS;    h2_beam_lock bl;    /* Called from the red thread to add buckets to the beam */    if (enter_yellow(beam, &bl) == APR_SUCCESS) {        r_purge_reds(beam);                if (beam->aborted) {            status = APR_ECONNABORTED;        }        else if (red_brigade) {            int force_report = !APR_BRIGADE_EMPTY(red_brigade);             while (!APR_BRIGADE_EMPTY(red_brigade)                   && status == APR_SUCCESS) {                bred = APR_BRIGADE_FIRST(red_brigade);                status = append_bucket(beam, bred, block, beam->red_pool, &bl);            }            report_production(beam, force_report);            if (beam->m_cond) {                apr_thread_cond_broadcast(beam->m_cond);            }        }        report_consumption(beam, 0);        leave_yellow(beam, &bl);    }    return status;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:32,


示例3: h2_stream_read_to

apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb,                                apr_size_t *plen, int *peos){    apr_status_t status = APR_SUCCESS;    if (stream->rst_error) {        return APR_ECONNRESET;    }        if (APR_BRIGADE_EMPTY(stream->bbout)) {        apr_size_t tlen = *plen;        int eos;        status = h2_mplx_out_read_to(stream->session->mplx, stream->id,                                      stream->bbout, &tlen, &eos);    }        if (status == APR_SUCCESS && !APR_BRIGADE_EMPTY(stream->bbout)) {        status = h2_transfer_brigade(bb, stream->bbout, stream->pool,                                      plen, peos);    }    else {        *plen = 0;        *peos = 0;    }    if (status == APR_SUCCESS && !*peos && !*plen) {        status = APR_EAGAIN;    }    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->session->c,                  "h2_stream(%ld-%d): read_to, len=%ld eos=%d",                  stream->session->id, stream->id, (long)*plen, *peos);    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:33,


示例4: h2_beam_shutdown

apr_status_t h2_beam_shutdown(h2_bucket_beam *beam, apr_read_type_e block){    apr_status_t status;    h2_beam_lock bl;        if ((status = enter_yellow(beam, &bl)) == APR_SUCCESS) {        r_purge_reds(beam);        h2_blist_cleanup(&beam->red);        beam_close(beam);        report_consumption(beam, 0);                while (status == APR_SUCCESS                && (!H2_BPROXY_LIST_EMPTY(&beam->proxies)                   || (beam->green && !APR_BRIGADE_EMPTY(beam->green)))) {            if (block == APR_NONBLOCK_READ || !bl.mutex) {                status = APR_EAGAIN;                break;            }            if (beam->m_cond) {                apr_thread_cond_broadcast(beam->m_cond);            }            status = wait_cond(beam, bl.mutex);        }        leave_yellow(beam, &bl);    }    return status;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:27,


示例5: APU_DECLARE

APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,                                           apr_brigade_flush flush, void *ctx,                                           const char *str){    apr_size_t len = strlen(str);    apr_bucket *bkt = APR_BRIGADE_LAST(bb);    if (!APR_BRIGADE_EMPTY(bb) && APR_BUCKET_IS_HEAP(bkt)) {        /* If there is enough space available in a heap bucket         * at the end of the brigade, copy the string directly         * into the heap bucket         */        apr_bucket_heap *h = bkt->data;        apr_size_t bytes_avail = h->alloc_len - bkt->length;        if (bytes_avail >= len) {            char *buf = h->base + bkt->start + bkt->length;            memcpy(buf, str, len);            bkt->length += len;            return APR_SUCCESS;        }    }    /* If the string could not be copied into an existing heap     * bucket, delegate the work to apr_brigade_write(), which     * knows how to grow the brigade     */    return apr_brigade_write(bb, flush, ctx, str, len);}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:28,


示例6: h2_stream_prep_read

apr_status_t h2_stream_prep_read(h2_stream *stream,                                  apr_size_t *plen, int *peos){    apr_status_t status = APR_SUCCESS;    const char *src;        if (stream->bbout && !APR_BRIGADE_EMPTY(stream->bbout)) {        src = "stream";        status = h2_util_bb_avail(stream->bbout, plen, peos);        if (status == APR_SUCCESS && !*peos && !*plen) {            apr_brigade_cleanup(stream->bbout);            return h2_stream_prep_read(stream, plen, peos);        }    }    else {        src = "mplx";        status = h2_mplx_out_readx(stream->m, stream->id,                                    NULL, NULL, plen, peos);    }    if (status == APR_SUCCESS && !*peos && !*plen) {        status = APR_EAGAIN;    }    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->m->c,                  "h2_stream(%ld-%d): prep_read %s, len=%ld eos=%d",                  stream->m->id, stream->id,                   src, (long)*plen, *peos);    return status;}
开发者ID:r4-keisuke,项目名称:mod_h2,代码行数:28,


示例7: send_brigade_blocking

static apr_status_t send_brigade_blocking(apr_socket_t *s,                                          apr_bucket_brigade *bb,                                          apr_size_t *bytes_written,                                          conn_rec *c){    apr_status_t rv;    rv = APR_SUCCESS;    while (!APR_BRIGADE_EMPTY(bb)) {        rv = send_brigade_nonblocking(s, bb, bytes_written, c);        if (rv != APR_SUCCESS) {            if (APR_STATUS_IS_EAGAIN(rv)) {                /* Wait until we can send more data */                apr_int32_t nsds;                apr_interval_time_t timeout;                apr_pollfd_t pollset;                pollset.p = c->pool;                pollset.desc_type = APR_POLL_SOCKET;                pollset.reqevents = APR_POLLOUT;                pollset.desc.s = s;                apr_socket_timeout_get(s, &timeout);                rv = apr_poll(&pollset, 1, &nsds, timeout);                if (rv != APR_SUCCESS) {                    break;                }            }            else {                break;            }        }    }    return rv;}
开发者ID:Ga-vin,项目名称:apache,代码行数:34,


示例8: pass_out

static apr_status_t pass_out(apr_bucket_brigade *bb, void *ctx) {    h2_conn_io *io = (h2_conn_io*)ctx;    apr_status_t status;    apr_off_t bblen;        if (APR_BRIGADE_EMPTY(bb)) {        return APR_SUCCESS;    }        ap_update_child_status(io->connection->sbh, SERVER_BUSY_WRITE, NULL);    status = apr_brigade_length(bb, 0, &bblen);    if (status == APR_SUCCESS) {        ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, io->connection,                      "h2_conn_io(%ld): pass_out brigade %ld bytes",                      io->connection->id, (long)bblen);        status = ap_pass_brigade(io->connection->output_filters, bb);        if (status == APR_SUCCESS) {            io->bytes_written += (apr_size_t)bblen;            io->last_write = apr_time_now();        }        apr_brigade_cleanup(bb);    }    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:25,


示例9: APU_DECLARE

APU_DECLARE(apr_bucket_brigade *) apr_brigade_split_ex(apr_bucket_brigade *b,                                                       apr_bucket *e,                                                       apr_bucket_brigade *a){    apr_bucket *f;    if (!a) {        a = apr_brigade_create(b->p, b->bucket_alloc);    }    else if (!APR_BRIGADE_EMPTY(a)) {        apr_brigade_cleanup(a);    }    /* Return an empty brigade if there is nothing left in      * the first brigade to split off      */    if (e != APR_BRIGADE_SENTINEL(b)) {        f = APR_RING_LAST(&b->list);        APR_RING_UNSPLICE(e, f, link);        APR_RING_SPLICE_HEAD(&a->list, e, f, apr_bucket, link);    }    APR_BRIGADE_CHECK_CONSISTENCY(a);    APR_BRIGADE_CHECK_CONSISTENCY(b);    return a;}
开发者ID:0jpq0,项目名称:kbengine,代码行数:26,


示例10: h2_stream_set_response

apr_status_t h2_stream_set_response(h2_stream *stream, h2_response *response,                                    apr_bucket_brigade *bb){    apr_status_t status = APR_SUCCESS;        stream->response = response;    if (bb && !APR_BRIGADE_EMPTY(bb)) {        int move_all = INT_MAX;        /* we can move file handles from h2_mplx into this h2_stream as many         * as we want, since the lifetimes are the same and we are not freeing         * the ones in h2_mplx->io before this stream is done. */        status = h2_util_move(stream->bbout, bb, 16 * 1024, &move_all,                                "h2_stream_set_response");    }    if (APLOGctrace1(stream->session->c)) {        apr_size_t len = 0;        int eos = 0;        h2_util_bb_avail(stream->bbout, &len, &eos);        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, stream->session->c,                      "h2_stream(%ld-%d): set_response(%s), len=%ld, eos=%d",                       stream->session->id, stream->id, response->status,                      (long)len, (int)eos);    }    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:25,


示例11: h2_io_in_read

apr_status_t h2_io_in_read(h2_io *io, apr_bucket_brigade *bb,                            apr_size_t maxlen){    apr_off_t start_len = 0;    apr_bucket *last;    apr_status_t status;    if (io->rst_error) {        return APR_ECONNABORTED;    }        if (!io->bbin || APR_BRIGADE_EMPTY(io->bbin)) {        return io->eos_in? APR_EOF : APR_EAGAIN;    }        apr_brigade_length(bb, 1, &start_len);    last = APR_BRIGADE_LAST(bb);    status = h2_util_move(bb, io->bbin, maxlen, NULL, "h2_io_in_read");    if (status == APR_SUCCESS) {        apr_bucket *nlast = APR_BRIGADE_LAST(bb);        apr_off_t end_len = 0;        apr_brigade_length(bb, 1, &end_len);        if (last == nlast) {            return APR_EAGAIN;        }        io->input_consumed += (end_len - start_len);    }    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:29,


示例12: h2_conn_io_consider_flush

apr_status_t h2_conn_io_consider_flush(h2_conn_io *io){    apr_status_t status = APR_SUCCESS;    int flush_now = 0;        /* The HTTP/1.1 network output buffer/flush behaviour does not     * give optimal performance in the HTTP/2 case, as the pattern of     * buckets (data/eor/eos) is different.     * As long as we do not have found out the "best" way to deal with     * this, force a flush at least every WRITE_BUFFER_SIZE amount     * of data which seems to work nicely.     */    if (io->unflushed) {        apr_off_t len = 0;        if (!APR_BRIGADE_EMPTY(io->output)) {            apr_brigade_length(io->output, 0, &len);        }        len += io->buflen;        flush_now = (len >= WRITE_BUFFER_SIZE);    }        if (flush_now) {        return h2_conn_io_flush(io);    }    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:26,


示例13: setaside_remaining_output

/* * This function assumes that either ctx->buffered_bb == NULL, or * ctx->buffered_bb is empty, or ctx->buffered_bb == bb */static void setaside_remaining_output(ap_filter_t *f,                                      core_output_filter_ctx_t *ctx,                                      apr_bucket_brigade *bb,                                      conn_rec *c){    if (bb == NULL) {        return;    }    remove_empty_buckets(bb);    if (!APR_BRIGADE_EMPTY(bb)) {        c->data_in_output_filters = 1;        if (bb != ctx->buffered_bb) {            if (!ctx->deferred_write_pool) {                apr_pool_create(&ctx->deferred_write_pool, c->pool);                apr_pool_tag(ctx->deferred_write_pool, "deferred_write");            }            ap_save_brigade(f, &(ctx->buffered_bb), &bb,                            ctx->deferred_write_pool);        }    }    else if (ctx->deferred_write_pool) {        /*         * There are no more requests in the pipeline. We can just clear the         * pool.         */        apr_pool_clear(ctx->deferred_write_pool);    }}
开发者ID:pexip,项目名称:os-apache2,代码行数:32,


示例14: h2_stream_set_response

apr_status_t h2_stream_set_response(h2_stream *stream, h2_response *response,                                    apr_bucket_brigade *bb){    apr_status_t status = APR_SUCCESS;    if (!output_open(stream)) {        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, stream->session->c,                      "h2_stream(%ld-%d): output closed",                       stream->session->id, stream->id);        return APR_ECONNRESET;    }        stream->response = response;    if (bb && !APR_BRIGADE_EMPTY(bb)) {        int move_all = INT_MAX;        /* we can move file handles from h2_mplx into this h2_stream as many         * as we want, since the lifetimes are the same and we are not freeing         * the ones in h2_mplx->io before this stream is done. */        H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream set_response_pre");        status = h2_util_move(stream->bbout, bb, 16 * 1024, &move_all,                                "h2_stream_set_response");        H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream set_response_post");    }        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, stream->session->c,                  "h2_stream(%ld-%d): set_response(%d)",                   stream->session->id, stream->id, response->http_status);    return status;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:28,


示例15: h2_stream_readx

apr_status_t h2_stream_readx(h2_stream *stream,                              h2_io_data_cb *cb, void *ctx,                             apr_size_t *plen, int *peos){    if (stream->bbout && !APR_BRIGADE_EMPTY(stream->bbout)) {        return h2_util_bb_readx(stream->bbout, cb, ctx, plen, peos);    }    return h2_mplx_out_readx(stream->m, stream->id,                              cb, ctx, plen, peos);}
开发者ID:r4-keisuke,项目名称:mod_h2,代码行数:10,


示例16: h2_stream_read_to

apr_status_t h2_stream_read_to(h2_stream *stream, apr_bucket_brigade *bb,                                apr_off_t *plen, int *peos){    apr_status_t status = APR_SUCCESS;    apr_table_t *trailers = NULL;    H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream read_to_pre");    if (stream->rst_error) {        return APR_ECONNRESET;    }        if (APR_BRIGADE_EMPTY(stream->bbout)) {        apr_off_t tlen = *plen;        int eos;        status = h2_mplx_out_read_to(stream->session->mplx, stream->id,                                      stream->bbout, &tlen, &eos, &trailers);    }        if (status == APR_SUCCESS && !APR_BRIGADE_EMPTY(stream->bbout)) {        status = h2_transfer_brigade(bb, stream->bbout, stream->pool,                                      plen, peos);    }    else {        *plen = 0;        *peos = 0;    }    if (trailers && stream->response) {        ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->session->c,                      "h2_stream(%ld-%d): read_to, saving trailers",                      stream->session->id, stream->id);        h2_response_set_trailers(stream->response, trailers);    }        if (status == APR_SUCCESS && !*peos && !*plen) {        status = APR_EAGAIN;    }    H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream read_to_post");    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->session->c,                  "h2_stream(%ld-%d): read_to, len=%ld eos=%d",                  stream->session->id, stream->id, (long)*plen, *peos);    return status;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:43,


示例17: h2_conn_io_read

apr_status_t h2_conn_io_read(h2_conn_io *io,                             apr_read_type_e block,                             h2_conn_io_on_read_cb on_read_cb,                             void *puser){    apr_status_t status;    int done = 0;    ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, io->connection,                  "h2_conn_io: try read, block=%d", block);        if (!APR_BRIGADE_EMPTY(io->input)) {        /* Seems something is left from a previous read, lets         * satisfy our caller with the data we already have. */        status = h2_conn_io_bucket_read(io, block, on_read_cb, puser, &done);        apr_brigade_cleanup(io->input);        if (status != APR_SUCCESS || done) {            return status;        }    }    /* We only do a blocking read when we have no streams to process. So,     * in httpd scoreboard lingo, we are in a KEEPALIVE connection state.     * When reading non-blocking, we do have streams to process and update     * child with NULL request. That way, any current request information     * in the scoreboard is preserved.     */    if (block == APR_BLOCK_READ) {        ap_update_child_status_from_conn(io->connection->sbh,                                          SERVER_BUSY_KEEPALIVE,                                          io->connection);    }    else {        ap_update_child_status(io->connection->sbh, SERVER_BUSY_READ, NULL);    }    /* TODO: replace this with a connection filter itself, so that we     * no longer need to transfer incoming buckets to our own brigade.      */    status = ap_get_brigade(io->connection->input_filters,                            io->input, AP_MODE_READBYTES,                            block, 64 * 4096);    switch (status) {        case APR_SUCCESS:            return h2_conn_io_bucket_read(io, block, on_read_cb, puser, &done);        case APR_EOF:        case APR_EAGAIN:            break;        default:            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, io->connection,                          "h2_conn_io: error reading");            break;    }    return status;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:54,


示例18: h2_beam_empty

int h2_beam_empty(h2_bucket_beam *beam){    int empty = 1;    h2_beam_lock bl;        if (enter_yellow(beam, &bl) == APR_SUCCESS) {        empty = (H2_BLIST_EMPTY(&beam->red)                  && (!beam->green || APR_BRIGADE_EMPTY(beam->green)));        leave_yellow(beam, &bl);    }    return empty;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:12,


示例19: out_write

static apr_status_t out_write(h2_mplx *m, h2_io *io,                               ap_filter_t* f, apr_bucket_brigade *bb,                              apr_table_t *trailers,                              struct apr_thread_cond_t *iowait){    apr_status_t status = APR_SUCCESS;    /* We check the memory footprint queued for this stream_id     * and block if it exceeds our configured limit.     * We will not split buckets to enforce the limit to the last     * byte. After all, the bucket is already in memory.     */    while (status == APR_SUCCESS            && !APR_BRIGADE_EMPTY(bb)            && !is_aborted(m, &status)) {                status = h2_io_out_write(io, bb, m->stream_max_mem, trailers,                                 &m->tx_handles_reserved);        /* Wait for data to drain until there is room again or         * stream timeout expires */        h2_io_signal_init(io, H2_IO_WRITE, m->stream_timeout, iowait);        while (status == APR_SUCCESS               && !APR_BRIGADE_EMPTY(bb)                && iowait               && (m->stream_max_mem <= h2_io_out_length(io))               && !is_aborted(m, &status)) {            trailers = NULL;            if (f) {                ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, f->c,                              "h2_mplx(%ld-%d): waiting for out drain",                               m->id, io->id);            }            status = h2_io_signal_wait(m, io);        }        h2_io_signal_exit(io);    }    apr_brigade_cleanup(bb);        return status;}
开发者ID:Sp1l,项目名称:mod_h2,代码行数:39,


示例20: h2_conn_io_bucket_read

static apr_status_t h2_conn_io_bucket_read(h2_conn_io *io,                                           apr_read_type_e block,                                           h2_conn_io_on_read_cb on_read_cb,                                           void *puser, int *pdone){    apr_status_t status = APR_SUCCESS;    apr_size_t readlen = 0;    *pdone = 0;        while (status == APR_SUCCESS && !*pdone           && !APR_BRIGADE_EMPTY(io->input)) {                apr_bucket* bucket = APR_BRIGADE_FIRST(io->input);        if (APR_BUCKET_IS_METADATA(bucket)) {            /* we do nothing regarding any meta here */        }        else {            const char *bucket_data = NULL;            apr_size_t bucket_length = 0;            status = apr_bucket_read(bucket, &bucket_data,                                     &bucket_length, block);                        if (status == APR_SUCCESS && bucket_length > 0) {                if (APLOGctrace2(io->connection)) {                    char buffer[32];                    h2_util_hex_dump(buffer, sizeof(buffer)/sizeof(buffer[0]),                                     bucket_data, bucket_length);                    ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, io->connection,                                  "h2_conn_io(%ld): read %d bytes: %s",                                  io->connection->id, (int)bucket_length, buffer);                }                                if (bucket_length > 0) {                    apr_size_t consumed = 0;                    status = on_read_cb(bucket_data, bucket_length,                                        &consumed, pdone, puser);                    if (status == APR_SUCCESS && bucket_length > consumed) {                        /* We have data left in the bucket. Split it. */                        status = apr_bucket_split(bucket, consumed);                    }                    readlen += consumed;                }            }        }        apr_bucket_delete(bucket);    }    if (readlen == 0 && status == APR_SUCCESS && block == APR_NONBLOCK_READ) {        return APR_EAGAIN;    }    return status;}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:51,


示例21: proxy_wstunnel_transfer

static int proxy_wstunnel_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,                                     apr_bucket_brigade *bb, char *name){    int rv;#ifdef DEBUGGING    apr_off_t len;#endif    do {        apr_brigade_cleanup(bb);        rv = ap_get_brigade(c_i->input_filters, bb, AP_MODE_READBYTES,                            APR_NONBLOCK_READ, AP_IOBUFSIZE);        if (rv == APR_SUCCESS) {            if (c_o->aborted) {                return APR_EPIPE;            }            if (APR_BRIGADE_EMPTY(bb)) {                break;            }#ifdef DEBUGGING            len = -1;            apr_brigade_length(bb, 0, &len);            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02440)                          "read %" APR_OFF_T_FMT                          " bytes from %s", len, name);#endif            rv = ap_pass_brigade(c_o->output_filters, bb);            if (rv == APR_SUCCESS) {                ap_fflush(c_o->output_filters, bb);            }            else {                ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(02441)                              "error on %s - ap_pass_brigade",                              name);            }        } else if (!APR_STATUS_IS_EAGAIN(rv) && !APR_STATUS_IS_EOF(rv)) {            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, APLOGNO(02442)                          "error on %s - ap_get_brigade",                          name);        }    } while (rv == APR_SUCCESS);    ap_log_rerror(APLOG_MARK, APLOG_TRACE2, rv, r, "wstunnel_transfer complete");    if (APR_STATUS_IS_EAGAIN(rv)) {        rv = APR_SUCCESS;    }       return rv;}
开发者ID:Summyhaha,项目名称:Tomcat,代码行数:50,


示例22: h2_stream_set_response

apr_status_t h2_stream_set_response(h2_stream *stream, h2_response *response,                                    apr_bucket_brigade *bb){    stream->response = response;    if (bb && !APR_BRIGADE_EMPTY(bb)) {        if (!stream->bbout) {            stream->bbout = apr_brigade_create(stream->pool,                                                stream->m->c->bucket_alloc);        }        return h2_util_move(stream->bbout, bb, 16 * 1024, NULL,                              "h2_stream_set_response");    }    return APR_SUCCESS;}
开发者ID:r4-keisuke,项目名称:mod_h2,代码行数:14,


示例23: h2_stream_input_flush

static apr_status_t h2_stream_input_flush(h2_stream *stream){    apr_status_t status = APR_SUCCESS;    if (stream->bbin && !APR_BRIGADE_EMPTY(stream->bbin)) {        status = h2_mplx_in_write(stream->session->mplx, stream->id, stream->bbin);        if (status != APR_SUCCESS) {            ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, stream->session->mplx->c,                          "h2_stream(%ld-%d): flushing input data",                          stream->session->id, stream->id);        }    }    return status;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:14,


示例24: test_create

static void test_create(abts_case *tc, void *data){    apr_bucket_alloc_t *ba;    apr_bucket_brigade *bb;    ba = apr_bucket_alloc_create(p);    bb = apr_brigade_create(p, ba);    ABTS_ASSERT(tc, "new brigade not NULL", bb != NULL);    ABTS_ASSERT(tc, "new brigade is empty", APR_BRIGADE_EMPTY(bb));    apr_brigade_destroy(bb);    apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:14,


示例25: jxr_append_brigade

apr_status_t jxr_append_brigade(request_rec *r, apr_bucket_brigade *dest, apr_bucket_brigade *bb, int *eos_seen){	apr_size_t max_msglen = MAX_PACKET_SIZE - sizeof(Jaxer_Header);	apr_status_t rv;	while (!APR_BRIGADE_EMPTY(bb)) 	{		apr_size_t readlen;		const char *buffer;				apr_bucket *e = APR_BRIGADE_FIRST(bb);		if (APR_BUCKET_IS_EOS(e) )		{			apr_bucket_delete(e);			if (eos_seen)				*eos_seen = 1;			continue;		}		if (APR_BUCKET_IS_METADATA(e)) {			apr_bucket_delete(e);			continue;		}				/* Read the bucket now */		if ((rv = apr_bucket_read(e, &buffer, &readlen, APR_BLOCK_READ)) != APR_SUCCESS) 		{			ap_log_perror(APLOG_MARK, APLOG_INFO, rv, r->pool, "mod_jaxer: can't read data from handler");			return rv;		}				if (readlen > max_msglen)		{        	apr_bucket_split(e, max_msglen);		}else		{			APR_BUCKET_REMOVE(e);			APR_BRIGADE_INSERT_TAIL(dest, e);		}	}	if ((rv=apr_brigade_destroy(bb)) != APR_SUCCESS)	{		ap_log_perror(APLOG_MARK, APLOG_INFO, rv, r->pool, "mod_jaxer: failed to destroy brigade.");		return rv;	}	return APR_SUCCESS;}
开发者ID:absynce,项目名称:Jaxer,代码行数:49,


示例26: h2_stream_readx

apr_status_t h2_stream_readx(h2_stream *stream,                              h2_io_data_cb *cb, void *ctx,                             apr_off_t *plen, int *peos){    apr_status_t status = APR_SUCCESS;    apr_table_t *trailers = NULL;    const char *src;        H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream readx_pre");    if (stream->rst_error) {        return APR_ECONNRESET;    }    *peos = 0;    if (!APR_BRIGADE_EMPTY(stream->bbout)) {        apr_off_t origlen = *plen;                src = "stream";        status = h2_util_bb_readx(stream->bbout, cb, ctx, plen, peos);        if (status == APR_SUCCESS && !*peos && !*plen) {            apr_brigade_cleanup(stream->bbout);            *plen = origlen;            return h2_stream_readx(stream, cb, ctx, plen, peos);        }    }    else {        src = "mplx";        status = h2_mplx_out_readx(stream->session->mplx, stream->id,                                    cb, ctx, plen, peos, &trailers);    }        if (trailers && stream->response) {        ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->session->c,                      "h2_stream(%ld-%d): readx, saving trailers",                      stream->session->id, stream->id);        h2_response_set_trailers(stream->response, trailers);    }        if (status == APR_SUCCESS && !*peos && !*plen) {        status = APR_EAGAIN;    }        H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream readx_post");    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, stream->session->c,                  "h2_stream(%ld-%d): readx %s, len=%ld eos=%d",                  stream->session->id, stream->id, src, (long)*plen, *peos);    H2_STREAM_OUT(APLOG_TRACE2, stream, "h2_stream readx_post");        return status;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:49,


示例27: h2_io_in_write

apr_status_t h2_io_in_write(h2_io *io, apr_bucket_brigade *bb){    if (io->eos_in) {        return APR_EOF;    }    io->eos_in = h2_util_has_eos(bb, 0);    if (!APR_BRIGADE_EMPTY(bb)) {        if (!io->bbin) {            io->bbin = apr_brigade_create(io->bbout->p,                                           io->bbout->bucket_alloc);        }        return h2_util_move(io->bbin, bb, 0, 0, "h2_io_in_write");    }    return APR_SUCCESS;}
开发者ID:MichealYangGitHub,项目名称:C,代码行数:15,



注:本文中的APR_BRIGADE_EMPTY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ APR_BRIGADE_FIRST函数代码示例
C++ APR_ASSERT_SUCCESS函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。