[nginx] SPDY: a bit smarter ngx_http_spdy_filter_get_data_frame().

Valentin Bartenev vbart at nginx.com
Thu Dec 26 13:05:25 UTC 2013


details:   http://hg.nginx.org/nginx/rev/97f6cd787766
branches:  
changeset: 5495:97f6cd787766
user:      Valentin Bartenev <vbart at nginx.com>
date:      Thu Dec 26 17:03:16 2013 +0400
description:
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.

diffstat:

 src/http/ngx_http_spdy_filter_module.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (60 lines):

diff -r 27f9d5f68c1c -r 97f6cd787766 src/http/ngx_http_spdy_filter_module.c
--- a/src/http/ngx_http_spdy_filter_module.c	Thu Dec 26 17:03:16 2013 +0400
+++ b/src/http/ngx_http_spdy_filter_module.c	Thu Dec 26 17:03:16 2013 +0400
@@ -33,8 +33,8 @@ static ngx_inline ngx_int_t ngx_http_spd
     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_reque
     }
 
     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_reque
 
 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_
         }
     }
 
+    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_
     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;
 }



More information about the nginx-devel mailing list