Welcome! Log In Create A New Profile

Advanced

All I want for easter is a working module

April 11, 2020 10:16AM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

All I want for easter is a working module

splitice April 11, 2020 10:16AM

Re: All I want for easter is a working module

J.R. April 11, 2020 11:34AM

Re: All I want for easter is a working module

Mathew Heard April 11, 2020 09:00PM

Re: All I want for easter is a working module

daBee April 12, 2020 12:56AM

Re: All I want for easter is a working module

Mathew Heard April 12, 2020 02:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready