optimization

This commit is contained in:
Igor Sysoev 2007-12-27 20:32:43 +00:00
parent ce5d6e3237
commit 86b915901a
6 changed files with 17 additions and 25 deletions

View File

@ -111,10 +111,9 @@ ngx_http_flv_handler(ngx_http_request_t *r)
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
if (rc == NGX_ERROR) {
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
switch (of.err) {
case 0:

View File

@ -125,10 +125,9 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
if (rc == NGX_ERROR) {
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
switch (of.err) {
case 0:
@ -143,20 +142,18 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
case NGX_EACCES:
level = NGX_LOG_ERR;
rc = NGX_DECLINED;
break;
default:
level = NGX_LOG_CRIT;
rc = NGX_DECLINED;
break;
}
ngx_log_error(level, log, of.err,
ngx_open_file_n " \"%s\" failed", path.data);
return rc;
return NGX_DECLINED;
}
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);

View File

@ -214,10 +214,9 @@ ngx_http_index_handler(ngx_http_request_t *r)
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
if (rc == NGX_ERROR) {
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, of.err,
ngx_open_file_n " \"%s\" failed", path.data);

View File

@ -102,10 +102,9 @@ ngx_http_static_handler(ngx_http_request_t *r)
of.errors = clcf->open_file_cache_errors;
of.events = clcf->open_file_cache_events;
rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
if (rc == NGX_ERROR) {
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
switch (of.err) {
case 0:

View File

@ -613,7 +613,6 @@ sendfile(r, filename, offset = -1, bytes = 0)
char *filename;
int offset;
size_t bytes;
ngx_int_t rc;
ngx_str_t path;
ngx_buf_t *b;
ngx_open_file_info_t of;
@ -657,10 +656,9 @@ sendfile(r, filename, offset = -1, bytes = 0)
(void) ngx_cpystrn(path.data, filename, path.len + 1);
rc = ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool);
if (rc == NGX_ERROR) {
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
!= NGX_OK)
{
if (of.err == 0) {
XSRETURN_EMPTY;
}

View File

@ -982,7 +982,7 @@ ngx_http_script_file_code(ngx_http_script_engine_t *e)
of.events = clcf->open_file_cache_events;
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
== NGX_ERROR)
!= NGX_OK)
{
if (of.err != NGX_ENOENT && of.err != NGX_ENOTDIR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,