All I want for easter is a working module

Mathew Heard mat999 at gmail.com
Sat Apr 11 14:14:44 UTC 2020


Could anyone help me out with the problem here?

ngx_module_t ngx_http_slow_module = {
NGX_MODULE_V1,
&ngx_http_slow_module_ctx, /* module context */
ngx_http_slow_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
ngx_http_slow_init_worker, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
NULL, /* exit master */
NGX_MODULE_V1_PADDING
};
[...]
void ngx_http_slow_handler(ngx_event_t *ev){
ngx_log_error(NGX_LOG_ERR, ev->log, 0, "run timer");
}

static ngx_event_t ngx_http_slow_timer;
static ngx_connection_t dumb;

static ngx_int_t ngx_http_slow_init_worker(ngx_cycle_t *cycle){
if (ngx_process != NGX_PROCESS_WORKER){
return NGX_OK;
}

ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "start timer");
memset(&ngx_http_slow_timer, 0, sizeof(ngx_http_slow_timer));
ngx_http_slow_timer.log = ngx_cycle->log;
ngx_http_slow_timer.handler = ngx_http_slow_handler;
ngx_http_slow_timer.data = &dumb;
dumb.fd = (ngx_socket_t) -1;
ngx_add_timer(&ngx_http_slow_timer, (ngx_msec_t)NGX_HTTP_SLOW_INTERVAL);

return NGX_OK;
}


"Start timer" is output in the logs, but not "run timer". And I can't see
why.

Regards,
Mathew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200412/f3449997/attachment.htm>


More information about the nginx mailing list