diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /src/nxt_job_file_cache.c | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'src/nxt_job_file_cache.c')
-rw-r--r-- | src/nxt_job_file_cache.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/nxt_job_file_cache.c b/src/nxt_job_file_cache.c new file mode 100644 index 00000000..47468dc2 --- /dev/null +++ b/src/nxt_job_file_cache.c @@ -0,0 +1,47 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) NGINX, Inc. + */ + + +#include <nxt_main.h> + + +typedef struct { + nxt_cache_node_t node; + nxt_file_t file; +} nxt_file_cache_t; + + +void +nxt_job_file_cache_read(nxt_cache_t *cache, nxt_job_file_t *jbf) +{ + nxt_file_cache_node_t *node; + + node = nxt_cache_find(cache); + + if (node != NULL) { + + if (node->fd != -1) { + nxt_job_return(&jbf->job, jbf->ready_handler); + return; + } + + if (node->error != 0) { + nxt_job_return(&jbf->job, jbf->error_handler); + return; + } + +#if (NXT_THREADS) + + if (node->accessed + 60 > nxt_thread_time()) { + jbf->job.thread_pool = NULL; + } + +#endif + + } + + nxt_job_file_read(jbf); +} |