[dev] ngx_write_chain_to_temp_file and NGX_AGAIN

Igor Sysoev is at rambler-co.ru
Tue Nov 27 23:35:23 MSK 2007


On Tue, Nov 27, 2007 at 07:08:31PM +0100, Manlio Perillo wrote:

> I'm reading the code for writing a temporary buffer in a temporary file, 
> and I have noted something not very clear.
> 
> Here is the code (core/ngx_file.c):
> ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
> {
>     ngx_int_t  rc;
> 
>     if (tf->file.fd == NGX_INVALID_FILE) {
>         rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
>                                   tf->persistent, tf->clean,
>                                   tf->access);
> 
>         if (rc == NGX_ERROR || rc == NGX_AGAIN) {
>             return rc;
>         }
> 
> 
> 
> However it seems that ngx_create_temp_file never returns NGX_AGAIN.
> 
> Moreover the functions ngx_event_pipe_write_chain_to_temp_file 
> (event/ngx_event_pipe.c) and ngx_http_write_request_body 
> (http/ngx_http_request_body) only check for NGX_ERROR and not for NGX_AGAIN.
> 
> So, should I check for NGX_ERROR only?

Yes. This is artefact of times when I plan to do aync open() files using
special threads.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list