nginx-0.0.1-2003-12-02-08:47:29 import

This commit is contained in:
Igor Sysoev 2003-12-02 05:47:29 +00:00
parent 4fc368fa30
commit a7dcbaf4ff
4 changed files with 23 additions and 7 deletions

View File

@ -25,9 +25,6 @@ struct ngx_event_s {
/* TODO rename to handler, move flags to struct start */
void (*event_handler)(ngx_event_t *ev);
void *context;
char *action;
u_int index;
/* queue in mutex(), aio_read(), aio_write() */

View File

@ -47,8 +47,14 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash,
&& c[i].key.len == key->len
&& ngx_rstrncmp(c[i].key.data, key->data, key->len) == 0)
{
#if 0
if (c[i].expired) {
ngx_mutex_unlock(&hash->mutex);
return (void *) NGX_AGAIN;
}
#endif
c[i].refs++;
ngx_mutex_unlock(&hash->mutex);
if ((!(c[i].notify && (ngx_event_flags & NGX_HAVE_KQUEUE_EVENT)))
&& (ngx_cached_time - c[i].updated >= hash->update))
@ -56,6 +62,8 @@ ngx_http_cache_t *ngx_http_cache_get(ngx_http_cache_hash_t *hash,
c[i].expired = 1;
}
ngx_mutex_unlock(&hash->mutex);
if (cleanup) {
cleanup->data.cache.hash = hash;
cleanup->data.cache.cache = &c[i];
@ -217,6 +225,12 @@ void ngx_http_cache_free(ngx_http_cache_t *cache,
}
void ngx_http_cache_lock(ngx_http_cache_hash_t *hash, ngx_http_cache_t *cache)
{
ngx_mutex_lock(&hash->mutex);
}
void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
ngx_http_cache_t *cache, ngx_log_t *log)
{
@ -234,9 +248,11 @@ void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
#if 0
ngx_add_file_event(ngx_fd_t, ngx_event_handler_pt *handler, void *data)
ngx_http_cache_add_file_event(ngx_http_cache_hash_t *hash,
ngx_http_cache_t *cache)
{
ngx_event_t *ev;
ngx_event_t *ev;
ngx_http_cache_event_ctx_t *ctx;
ev = &ngx_cycle->read_events[fd];
ngx_memzero(ev, sizeof(ngx_event_t);
@ -250,7 +266,7 @@ ngx_add_file_event(ngx_fd_t, ngx_event_handler_pt *handler, void *data)
void ngx_http_cache_invalidate(ngx_event_t *ev)
{
ngx_http_cache_ctx_t *ctx;
ngx_http_cache_event_ctx_t *ctx;
ctx = ev->data;

View File

@ -101,6 +101,7 @@ ngx_http_cache_t *ngx_http_cache_alloc(ngx_http_cache_hash_t *hash,
ngx_str_t *value, ngx_log_t *log);
void ngx_http_cache_free(ngx_http_cache_t *cache,
ngx_str_t *key, ngx_str_t *value, ngx_log_t *log);
void ngx_http_cache_lock(ngx_http_cache_hash_t *hash, ngx_http_cache_t *cache);
void ngx_http_cache_unlock(ngx_http_cache_hash_t *hash,
ngx_http_cache_t *cache, ngx_log_t *log);

View File

@ -176,6 +176,8 @@ ngx_log_debug(c->log, "NOPUSH");
hsize = 0;
}
sent = 0;
rc = sendfile(file->file->fd, c->fd, file->file_pos,
fsize + hsize, &hdtr, &sent, 0);