<div dir="ltr">J.R,<div><br>You won't find it publicly as all it is a testing module with the goal of establishing a working timer. If you want the source code for it you need only ask. Here you go.</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(106,153,85)">/*</span></div><div><span style="color:rgb(106,153,85)"> * Copyright (C) Mathew Heard.</span></div><div><span style="color:rgb(106,153,85)"> */</span></div><br><br><div><span style="color:rgb(197,134,192)">#include</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(206,145,120)"><ngx_config.h></span></div><div><span style="color:rgb(197,134,192)">#include</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(206,145,120)"><ngx_core.h></span></div><div><span style="color:rgb(197,134,192)">#include</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(206,145,120)"><ngx_http.h></span></div><div><span style="color:rgb(197,134,192)">#include</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(206,145,120)"><ngx_event.h></span></div><br><div><span style="color:rgb(197,134,192)">#define</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(220,220,170)">NGX_HTTP_SLOW_INTERVAL</span><span style="color:rgb(86,156,214)"> </span><span style="color:rgb(181,206,168)">7000</span></div><br><div><span style="color:rgb(86,156,214)">typedef</span> <span style="color:rgb(86,156,214)">struct</span> {</div><div>    <span style="color:rgb(78,201,176)">ngx_flag_t</span>  enable;</div><div>} <span style="color:rgb(78,201,176)">ngx_http_slow_conf_t</span>;</div><br><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">void</span> *<span style="color:rgb(220,220,170)">ngx_http_slow_create_conf</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cycle);</div><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">char</span> *<span style="color:rgb(220,220,170)">ngx_http_slow_init_conf</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cycle, <span style="color:rgb(86,156,214)">void</span> *conf);</div><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">char</span> *<span style="color:rgb(220,220,170)">ngx_http_slow_enable</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cf, <span style="color:rgb(86,156,214)">void</span> *post, <span style="color:rgb(86,156,214)">void</span> *data);</div><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_conf_post_t</span>  ngx_http_slow_enable_post = { ngx_http_slow_enable };</div><br><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_command_t</span>  ngx_http_slow_commands[] = {</div><br><div>    { <span style="color:rgb(220,220,170)">ngx_string</span>(<span style="color:rgb(206,145,120)">"slow"</span>),</div><div>      NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG,</div><div>      ngx_conf_set_flag_slot,</div><div>      NGX_HTTP_MAIN_CONF_OFFSET,</div><div>      <span style="color:rgb(220,220,170)">offsetof</span>(<span style="color:rgb(78,201,176)">ngx_http_slow_conf_t</span>, enable),</div><div>      &ngx_http_slow_enable_post },</div><br><div>      ngx_null_command</div><div>};</div><br><div><span style="color:rgb(78,201,176)">ngx_http_module_t</span> ngx_http_slow_module_ctx = {</div><div>    <span style="color:rgb(86,156,214)">NULL</span>, <span style="color:rgb(106,153,85)">/*  preconfiguration */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                  <span style="color:rgb(106,153,85)">/*  postconfiguration */</span></div><br><div>    ngx_http_slow_create_conf,    <span style="color:rgb(106,153,85)">/*  create main configuration */</span></div><div>    ngx_http_slow_init_conf,      <span style="color:rgb(106,153,85)">/*  init main configuration */</span></div><br><div>    <span style="color:rgb(86,156,214)">NULL</span>,     <span style="color:rgb(106,153,85)">/*  create server configuration */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,      <span style="color:rgb(106,153,85)">/*  merge server configuration */</span></div><br><div>    <span style="color:rgb(86,156,214)">NULL</span>,     <span style="color:rgb(106,153,85)">/*  create location configuration */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>       <span style="color:rgb(106,153,85)">/*  merge location configuration */</span></div><div>};</div><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_int_t</span> <span style="color:rgb(220,220,170)">ngx_http_slow_init_worker</span>(<span style="color:rgb(78,201,176)">ngx_cycle_t</span> *cycle);</div><br><div><span style="color:rgb(78,201,176)">ngx_module_t</span>  ngx_http_slow_module = {</div><div>    NGX_MODULE_V1,</div><div>    &ngx_http_slow_module_ctx,                   <span style="color:rgb(106,153,85)">/* module context */</span></div><div>    ngx_http_slow_commands,                      <span style="color:rgb(106,153,85)">/* module directives */</span></div><div>    NGX_HTTP_MODULE,                       <span style="color:rgb(106,153,85)">/* module type */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* init master */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* init module */</span></div><div>    ngx_http_slow_init_worker,             <span style="color:rgb(106,153,85)">/* init process */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* init thread */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* exit thread */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* exit process */</span></div><div>    <span style="color:rgb(86,156,214)">NULL</span>,                                  <span style="color:rgb(106,153,85)">/* exit master */</span></div><div>    NGX_MODULE_V1_PADDING</div><div>};</div><br><br><div><span style="color:rgb(86,156,214)">void</span> <span style="color:rgb(220,220,170)">ngx_http_slow_handler</span>(<span style="color:rgb(78,201,176)">ngx_event_t</span> *ev){</div><div><span style="color:rgb(220,220,170)">ngx_log_error</span>(NGX_LOG_ERR, ev-><span style="color:rgb(156,220,254)">log</span>, <span style="color:rgb(181,206,168)">0</span>, <span style="color:rgb(206,145,120)">"run timer"</span>);</div><div>  <span style="color:rgb(106,153,85)">// set up the next tick in n seconds</span></div><div>  <span style="color:rgb(197,134,192)">if</span> (ngx_exiting) {</div><div>    <span style="color:rgb(197,134,192)">return</span>;</div><div>  }</div><div>  <span style="color:rgb(220,220,170)">ngx_add_timer</span>(ev,  (<span style="color:rgb(78,201,176)">ngx_msec_t</span>)NGX_HTTP_SLOW_INTERVAL);</div><div>}</div><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_event_t</span> ngx_http_slow_timer;</div><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_connection_t</span>  dumb;</div><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(78,201,176)">ngx_int_t</span> <span style="color:rgb(220,220,170)">ngx_http_slow_init_worker</span>(<span style="color:rgb(78,201,176)">ngx_cycle_t</span> *cycle){  </div><div>    <span style="color:rgb(197,134,192)">if</span> (ngx_process != NGX_PROCESS_WORKER){</div><div>        <span style="color:rgb(197,134,192)">return</span> NGX_OK;</div><div>    }</div><br><div>    <span style="color:rgb(220,220,170)">ngx_log_error</span>(NGX_LOG_ERR, ngx_cycle-><span style="color:rgb(156,220,254)">log</span>, <span style="color:rgb(181,206,168)">0</span>, <span style="color:rgb(206,145,120)">"start timer"</span>);</div><div>    <span style="color:rgb(220,220,170)">memset</span>(&ngx_http_slow_timer, <span style="color:rgb(181,206,168)">0</span>, <span style="color:rgb(86,156,214)">sizeof</span>(ngx_http_slow_timer));</div><div>    ngx_http_slow_timer.<span style="color:rgb(156,220,254)">log</span> = ngx_cycle-><span style="color:rgb(156,220,254)">log</span>;</div><div>    ngx_http_slow_timer.<span style="color:rgb(156,220,254)">handler</span> = ngx_http_slow_handler;</div><div>    ngx_http_slow_timer.<span style="color:rgb(156,220,254)">data</span> = &dumb;</div><div>    dumb.<span style="color:rgb(156,220,254)">fd</span> = (<span style="color:rgb(78,201,176)">ngx_socket_t</span>) -<span style="color:rgb(181,206,168)">1</span>;</div><div>    <span style="color:rgb(220,220,170)">ngx_add_timer</span>(&ngx_http_slow_timer,  (<span style="color:rgb(78,201,176)">ngx_msec_t</span>)NGX_HTTP_SLOW_INTERVAL);</div><br><div>    <span style="color:rgb(197,134,192)">return</span> NGX_OK;</div><div>}</div><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">void</span> *</div><div><span style="color:rgb(220,220,170)">ngx_http_slow_create_conf</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cycle)</div><div>{</div><div>    <span style="color:rgb(78,201,176)">ngx_http_slow_conf_t</span>  *fcf;</div><br><div>    fcf = <span style="color:rgb(220,220,170)">ngx_pcalloc</span>(cycle-><span style="color:rgb(156,220,254)">pool</span>, <span style="color:rgb(86,156,214)">sizeof</span>(<span style="color:rgb(78,201,176)">ngx_http_slow_conf_t</span>));</div><div>    <span style="color:rgb(197,134,192)">if</span> (fcf == <span style="color:rgb(86,156,214)">NULL</span>) {</div><div>        <span style="color:rgb(197,134,192)">return</span> <span style="color:rgb(86,156,214)">NULL</span>;</div><div>    }</div><br><div>    fcf-><span style="color:rgb(156,220,254)">enable</span> = NGX_CONF_UNSET;</div><br><div>    <span style="color:rgb(197,134,192)">return</span> fcf;</div><div>}</div><br><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">char</span> *</div><div><span style="color:rgb(220,220,170)">ngx_http_slow_init_conf</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cycle, <span style="color:rgb(86,156,214)">void</span> *conf)</div><div>{</div><div>    <span style="color:rgb(78,201,176)">ngx_http_slow_conf_t</span> *fcf = conf;</div><br><div>    <span style="color:rgb(220,220,170)">ngx_conf_init_value</span>(fcf-><span style="color:rgb(156,220,254)">enable</span>, <span style="color:rgb(181,206,168)">0</span>);</div><br><div>    <span style="color:rgb(197,134,192)">return</span> NGX_CONF_OK;</div><div>}</div><br><br><div><span style="color:rgb(86,156,214)">static</span> <span style="color:rgb(86,156,214)">char</span> *</div><div><span style="color:rgb(220,220,170)">ngx_http_slow_enable</span>(<span style="color:rgb(78,201,176)">ngx_conf_t</span> *cf, <span style="color:rgb(86,156,214)">void</span> *post, <span style="color:rgb(86,156,214)">void</span> *data)</div><div>{</div><div>    <span style="color:rgb(78,201,176)">ngx_flag_t</span>  *fp = data;</div><br><div>    <span style="color:rgb(197,134,192)">if</span> (*fp == <span style="color:rgb(181,206,168)">0</span>) {</div><div>        <span style="color:rgb(197,134,192)">return</span> NGX_CONF_OK;</div><div>    }</div><br><div>    <span style="color:rgb(197,134,192)">return</span> NGX_CONF_OK;</div><div>}</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 12 Apr 2020 at 01:33, J.R. <<a href="mailto:themadbeaker@gmail.com">themadbeaker@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I've never heard of 'ngx_http_slow_module'... Is there a github page<br>
or similar with the source code?<br>
<br>
It's going to take more than just selective snippets if you really<br>
want someone to help debug it...<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>