2 messages in ru.sysoev.nginxRe: [dev] ngx_write_chain_to_temp_fil...
FromSent OnAttachments
Manlio PerilloNov 27, 2007 10:08 am 
Igor SysoevNov 27, 2007 12:35 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [dev] ngx_write_chain_to_temp_file and NGX_AGAINActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Nov 27, 2007 12:35:00 pm
List:ru.sysoev.nginx

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.