[PATCH] Variables: added $tcpinfo_retrans

Alexey Ivanov savetherbtz at gmail.com
Mon Dec 21 17:53:58 UTC 2015


# HG changeset patch
# User Alexey Ivanov <SaveTheRbtz at GMail.com>
# Date 1450520577 28800
#      Sat Dec 19 02:22:57 2015 -0800
# Branch tcpi_retrans
# Node ID b018f837480dbad3dc45f1a2ba93fb99bc625ef5
# Parent  78b4e10b4367b31367aad3c83c9c3acdd42397c4
Variables: added $tcpinfo_retrans

This one is useful for debugging poor network conditions.

diff -r 78b4e10b4367 -r b018f837480d auto/unix
--- a/auto/unix	Thu Dec 17 16:39:15 2015 +0300
+++ b/auto/unix	Sat Dec 19 02:22:57 2015 -0800
@@ -384,6 +384,17 @@
 . auto/feature


+ngx_feature="TCP_INFO_RETRANS"
+ngx_feature_name="NGX_HAVE_TCP_INFO_RETRANS"
+ngx_feature_run=no
+ngx_feature_incs="#include <netinet/tcp.h>"
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="struct tcp_info ti;
+                  ti.tcpi_retrans"
+. auto/feature
+
+
 ngx_feature="accept4()"
 ngx_feature_name="NGX_HAVE_ACCEPT4"
 ngx_feature_run=no
diff -r 78b4e10b4367 -r b018f837480d src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c	Thu Dec 17 16:39:15 2015 +0300
+++ b/src/http/ngx_http_variables.c	Sat Dec 19 02:22:57 2015 -0800
@@ -343,6 +343,11 @@

     { ngx_string("tcpinfo_rcv_space"), NULL, ngx_http_variable_tcpinfo,
       3, NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
+#if (NGX_HAVE_TCP_INFO_RETRANS)
+    { ngx_string("tcpinfo_retrans"), NULL, ngx_http_variable_tcpinfo,
+      4, NGX_HTTP_VAR_NOCACHEABLE, 0 },
+#endif
 #endif

     { ngx_null_string, NULL, NULL, 0, 0, 0 }
@@ -1053,6 +1058,12 @@
         value = ti.tcpi_rcv_space;
         break;

+#if (NGX_HAVE_TCP_INFO_RETRANS)
+    case 4:
+        value = ti.tcpi_retrans;
+        break;
+#endif
+
     /* suppress warning */
     default:
         value = 0;


> On Dec 21, 2015, at 6:03 AM, David CARLIER <devnexen at gmail.com> wrote:
> 
> On 21 December 2015 at 13:57, Maxim Dounin <mdounin at mdounin.ru> wrote:
>> Hello!
>> 
>> On Mon, Dec 21, 2015 at 01:41:03PM +0000, David CARLIER wrote:
>> 
>>> I think FreeBSD has __tcpi_retrans but not "typedef" it though ...
>> 
>> It's just a placeholder for ABI compatibility, it's not set to
>> anything.
> 
> Yes it s many fields are not set (less than I first thought ...)
> 
> 
>> And either way it's named differently, so the patch
>> will break things.
>> 
> 
> Sure it would be meaningless in this case to use the FreeBSD field then.
> 
>> --
>> Maxim Dounin
>> http://nginx.org/
>> 
>> _______________________________________________
>> nginx-devel mailing list
>> nginx-devel at nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx-devel
> 
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20151221/6cafb2a2/attachment.bin>


More information about the nginx-devel mailing list