stream: sub variable len after output log to the buf

Duan Jiong djduanjiong at gmail.com
Thu Aug 13 02:17:43 UTC 2015


# HG changeset patch
# User Duan Jiong <djduanjiong at gmail.com>
# Date 1439431265 -28800
#      Thu Aug 13 10:01:05 2015 +0800
# Node ID 1c518d211b6b1acbd3a951218d948bd5ee4bec41
# Parent  1bd5eb20bd7c25f6cff96190d3ec048e3f3ebeec
stream: sub variable len after output log to the buf

Otherwise, the log before will be overwrote.

diff -r 1bd5eb20bd7c -r 1c518d211b6b src/stream/ngx_stream_handler.c
--- a/src/stream/ngx_stream_handler.c Wed Aug 12 12:56:59 2015 +0300
+++ b/src/stream/ngx_stream_handler.c Thu Aug 13 10:01:05 2015 +0800
@@ -328,6 +328,7 @@
     p = ngx_snprintf(buf, len, ", client: %V, server: %V",
                      &s->connection->addr_text,
                      &s->connection->listening->addr_text);
+    len -= p - buf;

     if (s->log_handler) {
         return s->log_handler(log, p, len);



More information about the nginx-devel mailing list