how to set timer?

Brice Figureau brice+nginx at daysofwonder.com
Wed Jul 22 23:21:26 MSD 2009


On 22/07/09 10:21, supergui wrote:
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////
> static ngx_event_t gdrive_timer_wev;
> static ngx_connection_t  dumb;
> 
> ngx_int_t ngx_http_gdrive_init_process(ngx_cycle_t *cycle) 
> {
>    ngx_log_error(NGX_LOG_DEBUG, cycle->log, 0, "set gdrive timer");
>    gdrive_timer_wev.handler=test_timer;
>    gdrive_timer_wev.log=cycle->log;
>    gdrive_timer_wev.data=&dumb;
>    dumb.fd=(ngx_socket_t)-1;
>    ngx_add_timer(&gdrive_timer_wev, 5000);
>    return NGX_OK;
> }
> 
> static
> void test_timer(ngx_event_t *wev)
> {
>         ngx_log_error(NGX_LOG_DEBUG, wev->log, 0, "gdrive timer out");
>         //printf("print time out\n");
> }
> ////////////////////////////////////////////////////////////////////////////////////////////////////////////
> 
> 
> why this doesn't work?

I don't know, but you can have a look to my upload progress module which 
uses some timers (and even re-triggered ones):

http://github.com/masterzen/nginx-upload-progress-module/tree/master

Maybe that can help you.
--
Brice Figureau
My Blog: http://www.masterzen.fr/





More information about the nginx mailing list