diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ngx_connection.h | 1 | ||||
| -rw-r--r-- | src/core/ngx_file.c | 6 | ||||
| -rw-r--r-- | src/core/ngx_hunk.h | 22 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/core/ngx_connection.h b/src/core/ngx_connection.h index bbb6a3b3b..b5c8c8852 100644 --- a/src/core/ngx_connection.h +++ b/src/core/ngx_connection.h @@ -85,6 +85,7 @@ extern ngx_chain_t *(*ngx_write_chain_proc) (ngx_connection_t *c, ngx_chain_t *in); +ssize_t ngx_recv_chain(ngx_connection_t *c, ngx_chain_t *ce); ngx_chain_t *ngx_write_chain(ngx_connection_t *c, ngx_chain_t *in, off_t flush); diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c index b05372232..7576c9b5f 100644 --- a/src/core/ngx_file.c +++ b/src/core/ngx_file.c @@ -28,7 +28,7 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, for ( ;; ) { snprintf(file->name.data + path->name.len + 1 + path->len, 11, - "%010d", num); + "%010u", num); ngx_create_hashed_filename(file, path); @@ -49,6 +49,8 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, file->fd = ngx_open_tempfile(file->name.data, persistent); +ngx_log_debug(file->log, "temp fd: %d" _ file->fd); + if (file->fd != NGX_INVALID_FILE) { return NGX_OK; } @@ -56,7 +58,7 @@ int ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, err = ngx_errno; if (err == NGX_EEXIST) { - num *= step; + num = (num + 1) * step; continue; } diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h index de691f84d..ddf4d04d2 100644 --- a/src/core/ngx_hunk.h +++ b/src/core/ngx_hunk.h @@ -11,26 +11,27 @@ /* hunk type */ /* the hunk is in memory */ -#define NGX_HUNK_IN_MEMORY 0x0001 +#define NGX_HUNK_IN_MEMORY 0x0001 /* the hunk's content can be changed */ -#define NGX_HUNK_TEMP 0x0002 +#define NGX_HUNK_TEMP 0x0002 /* the hunk's content is in cache and can not be changed */ -#define NGX_HUNK_MEMORY 0x0004 +#define NGX_HUNK_MEMORY 0x0004 /* the hunk's content is mmap()ed and can not be changed */ -#define NGX_HUNK_MMAP 0x0008 +#define NGX_HUNK_MMAP 0x0008 -#define NGX_HUNK_RECYCLED 0x0010 +#define NGX_HUNK_RECYCLED 0x0010 /* the hunk is in file */ -#define NGX_HUNK_FILE 0x0100 +#define NGX_HUNK_FILE 0x0100 /* hunk flags */ /* in thread state flush means to write the hunk completely before return */ /* in event state flush means to start to write the hunk */ -#define NGX_HUNK_FLUSH 0x1000 +#define NGX_HUNK_FLUSH 0x1000 /* last hunk */ -#define NGX_HUNK_LAST 0x2000 +#define NGX_HUNK_LAST 0x2000 +#define NGX_HUNK_LAST_SHADOW 0x4000 @@ -69,7 +70,12 @@ struct ngx_chain_s { ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size, int before, int after); +#define ngx_alloc_hunk(pool) ngx_palloc(pool, sizeof(ngx_hunk_t)) +#define ngx_alloc_chain_entry(pool) ngx_palloc(pool, sizeof(ngx_chain_t)) + +/* STUB */ #define ngx_create_chain_entry(pool) ngx_palloc(pool, sizeof(ngx_chain_t)) +/**/ #define ngx_add_hunk_to_chain(chain, h, pool, error) \ do { \ |
