Hello! On Sat, Jun 03, 2017 at 08:04:07PM -0700, Piotr Sikora via nginx-devel wrote:
> # HG changeset patch > # User Piotr Sikora <piotrsik...@google.com> > # Date 1491708381 25200 > # Sat Apr 08 20:26:21 2017 -0700 > # Node ID 2a48b9b6e67d91594c1787ebf721daebf5f88c91 > # Parent 716852cce9136d977b81a2d1b8b6f9fbca0dce49 > Output chain: propagate flush and last_buf flags to send_chain(). > > Signed-off-by: Piotr Sikora <piotrsik...@google.com> > > diff -r 716852cce913 -r 2a48b9b6e67d src/core/ngx_output_chain.c > --- a/src/core/ngx_output_chain.c > +++ b/src/core/ngx_output_chain.c > @@ -658,6 +658,7 @@ ngx_chain_writer(void *data, ngx_chain_t > ngx_chain_writer_ctx_t *ctx = data; > > off_t size; > + ngx_uint_t flush; > ngx_chain_t *cl, *ln, *chain; > ngx_connection_t *c; > > @@ -689,9 +690,10 @@ ngx_chain_writer(void *data, ngx_chain_t > > size += ngx_buf_size(in->buf); > > - ngx_log_debug2(NGX_LOG_DEBUG_CORE, c->log, 0, > - "chain writer buf fl:%d s:%uO", > - in->buf->flush, ngx_buf_size(in->buf)); > + ngx_log_debug3(NGX_LOG_DEBUG_CORE, c->log, 0, > + "chain writer buf fl:%d l:%d s:%uO", > + in->buf->flush, in->buf->last_buf, > + ngx_buf_size(in->buf)); > > cl = ngx_alloc_chain_link(ctx->pool); > if (cl == NULL) { > @@ -707,6 +709,8 @@ ngx_chain_writer(void *data, ngx_chain_t > ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0, > "chain writer in: %p", ctx->out); > > + flush = 0; > + > for (cl = ctx->out; cl; cl = cl->next) { > > #if 1 > @@ -732,9 +736,13 @@ ngx_chain_writer(void *data, ngx_chain_t > #endif > > size += ngx_buf_size(cl->buf); > + > + if (cl->buf->flush || cl->buf->last_buf) { > + flush = 1; > + } > } > > - if (size == 0 && !c->buffered) { > + if (size == 0 && !flush && !c->buffered) { > return NGX_OK; > } This is not normally needed, especially in case of flush. If you think it is - please clarify how do you expect to use it. Note well that in HTTP/2-related code the special flag c->need_last_buf is used to indicate that a (fake) connection needs an information about last_buf, thus allowing HTTP/2 c->send_chain() wrapper to add its own framing. If the goal is the same, please consider using the same approach. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel