SPDY: a bit smarter ngx_http_spdy_filter_get_data_frame().

There is no need to pass FLAG_FIN as a separate argument since it can always be
detected from the last_buf flag of the last frame buffer.

No functional changes.
This commit is contained in:
Valentin Bartenev 2013-12-26 17:03:16 +04:00
parent df49024997
commit aa22dc707b

View File

@ -33,8 +33,8 @@ static ngx_inline ngx_int_t ngx_http_spdy_filter_send(
ngx_connection_t *fc, ngx_http_spdy_stream_t *stream);
static ngx_http_spdy_out_frame_t *ngx_http_spdy_filter_get_data_frame(
ngx_http_spdy_stream_t *stream, size_t len, ngx_uint_t flags,
ngx_chain_t *first, ngx_chain_t *last);
ngx_http_spdy_stream_t *stream, size_t len, ngx_chain_t *first,
ngx_chain_t *last);
static ngx_int_t ngx_http_spdy_syn_frame_handler(
ngx_http_spdy_connection_t *sc, ngx_http_spdy_out_frame_t *frame);
@ -688,7 +688,7 @@ ngx_http_spdy_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
frame = ngx_http_spdy_filter_get_data_frame(stream, (size_t) size,
b->last_buf, out, cl);
out, cl);
if (frame == NULL) {
return NGX_ERROR;
}
@ -705,7 +705,7 @@ ngx_http_spdy_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
static ngx_http_spdy_out_frame_t *
ngx_http_spdy_filter_get_data_frame(ngx_http_spdy_stream_t *stream,
size_t len, ngx_uint_t fin, ngx_chain_t *first, ngx_chain_t *last)
size_t len, ngx_chain_t *first, ngx_chain_t *last)
{
u_char *p;
ngx_buf_t *buf;
@ -727,13 +727,13 @@ ngx_http_spdy_filter_get_data_frame(ngx_http_spdy_stream_t *stream,
}
}
flags = last->buf->last_buf ? NGX_SPDY_FLAG_FIN : 0;
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, stream->request->connection->log, 0,
"spdy:%ui create DATA frame %p: len:%uz fin:%ui",
stream->id, frame, len, fin);
"spdy:%ui create DATA frame %p: len:%uz flags:%ui",
stream->id, frame, len, flags);
if (len || fin) {
flags = fin ? NGX_SPDY_FLAG_FIN : 0;
if (len || flags) {
cl = ngx_chain_get_free_buf(stream->request->pool,
&stream->free_data_headers);
@ -782,7 +782,7 @@ ngx_http_spdy_filter_get_data_frame(ngx_http_spdy_stream_t *stream,
frame->size = NGX_SPDY_FRAME_HEADER_SIZE + len;
frame->priority = stream->priority;
frame->blocked = 0;
frame->fin = fin;
frame->fin = last->buf->last_buf;
return frame;
}