July 30, 2009 03:50AM
below codes are main illustration to my meaning, that is i set a timer(just 1000ms) to output body , but this doesn't work?
is this something do with the return value or i need to do more things?


char* out_buf[1024]={0}

static ngx_int_t
ngx_http_gdrive_handler(ngx_http_request_t *r)
//set my context
gdrive_module_ctx* gmc=(gdrive_module_ctx *)ngx_palloc(r->pool, sizeof(gdrive_module_ctx));
ngx_http_set_ctx(r, gmc, ngx_http_gdrive_module);

r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_length_n = sizeof(out_buf);

rc = ngx_http_send_header(r);

ngx_add_timer(&gmc->try_trunk_eve, 1000); //write 1000ms later

return NGX_AGAIN;

static void write_trunk(ngx_event_t *wev)
ngx_http_request_t *r = wev->data;
gdrive_module_ctx* gmc=ngx_http_get_module_ctx(r, ngx_http_gdrive_module);

ngx_buf_t *b;
ngx_chain_t out;

b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));

out.buf = b;
out.next = NULL;

b->memory = 1;
b->flush = 1;


* just can't output here?? the r->connection->fd has been change to an negative value?? but the connection has not been close yet, why?
ngx_http_output_filter(r, &out);
Subject Author Posted

why fail to ngx_http_output_filter after a timer????

supergui July 30, 2009 03:50AM

Re: why fail to ngx_http_output_filter after a timer????

supergui July 30, 2009 03:57AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 45
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