diff src/http/ngx_http_spdy.c @ 5529:e4adaa47af65

SPDY: store the length of frame instead of its whole size. The "length" value better corresponds with the specification and reduces confusion about whether frame's header is included in "size" or not. Also this change simplifies some parts of code, since in more cases the length of frame is more useful than its actual size, especially considering that the size of frame header is constant.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 22 Jan 2014 04:58:19 +0400
parents d5de6c25b759
children 827e53c136b0
line wrap: on
line diff
--- a/src/http/ngx_http_spdy.c
+++ b/src/http/ngx_http_spdy.c
@@ -494,9 +494,9 @@ ngx_http_spdy_send_output_queue(ngx_http
         out = frame;
 
         ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                       "spdy frame out: %p sid:%ui prio:%ui bl:%d size:%uz",
+                       "spdy frame out: %p sid:%ui prio:%ui bl:%d len:%uz",
                        out, out->stream ? out->stream->id : 0, out->priority,
-                       out->blocked, out->size);
+                       out->blocked, out->length);
     }
 
     cl = c->send_chain(c, cl, 0);
@@ -537,9 +537,9 @@ ngx_http_spdy_send_output_queue(ngx_http
         }
 
         ngx_log_debug4(NGX_LOG_DEBUG_HTTP, c->log, 0,
-                       "spdy frame sent: %p sid:%ui bl:%d size:%uz",
+                       "spdy frame sent: %p sid:%ui bl:%d len:%uz",
                        out, out->stream ? out->stream->id : 0,
-                       out->blocked, out->size);
+                       out->blocked, out->length);
     }
 
     frame = NULL;
@@ -1587,9 +1587,7 @@ ngx_http_spdy_send_settings(ngx_http_spd
     frame->handler = ngx_http_spdy_settings_frame_handler;
     frame->stream = NULL;
 #if (NGX_DEBUG)
-    frame->size = NGX_SPDY_FRAME_HEADER_SIZE
-                  + NGX_SPDY_SETTINGS_NUM_SIZE
-                  + NGX_SPDY_SETTINGS_PAIR_SIZE;
+    frame->length = NGX_SPDY_SETTINGS_NUM_SIZE + NGX_SPDY_SETTINGS_PAIR_SIZE;
 #endif
     frame->priority = NGX_SPDY_HIGHEST_PRIORITY;
     frame->blocked = 0;
@@ -1637,7 +1635,7 @@ ngx_http_spdy_settings_frame_handler(ngx
 
 
 static ngx_http_spdy_out_frame_t *
-ngx_http_spdy_get_ctl_frame(ngx_http_spdy_connection_t *sc, size_t size,
+ngx_http_spdy_get_ctl_frame(ngx_http_spdy_connection_t *sc, size_t length,
     ngx_uint_t priority)
 {
     ngx_chain_t                *cl;
@@ -1677,13 +1675,13 @@ ngx_http_spdy_get_ctl_frame(ngx_http_spd
     }
 
 #if (NGX_DEBUG)
-    if (size > NGX_SPDY_CTL_FRAME_BUFFER_SIZE - NGX_SPDY_FRAME_HEADER_SIZE) {
+    if (length > NGX_SPDY_CTL_FRAME_BUFFER_SIZE - NGX_SPDY_FRAME_HEADER_SIZE) {
         ngx_log_error(NGX_LOG_ALERT, sc->pool->log, 0,
-                      "requested control frame is too big: %uz", size);
+                      "requested control frame is too big: %uz", length);
         return NULL;
     }
 
-    frame->size = size;
+    frame->length = length;
 #endif
 
     frame->priority = priority;