mirror of
https://github.com/nginx/nginx.git
synced 2024-12-20 14:13:33 -06:00
nginx-0.0.3-2004-04-20-11:00:43 import
This commit is contained in:
parent
978dabaf1f
commit
bb57085904
@ -502,7 +502,7 @@ static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
ctx->in_hunk = ctx->in->hunk;
|
||||
ctx->in = ctx->in->next;
|
||||
|
||||
ctx->zstream.next_in = (u_char *) ctx->in_hunk->pos;
|
||||
ctx->zstream.next_in = ctx->in_hunk->pos;
|
||||
ctx->zstream.avail_in = ctx->in_hunk->last - ctx->in_hunk->pos;
|
||||
|
||||
if (ctx->in_hunk->type & NGX_HUNK_LAST) {
|
||||
@ -543,7 +543,7 @@ static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
||||
break;
|
||||
}
|
||||
|
||||
ctx->zstream.next_out = (u_char *) ctx->out_hunk->pos;
|
||||
ctx->zstream.next_out = ctx->out_hunk->pos;
|
||||
ctx->zstream.avail_out = conf->bufs.size;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
typedef int ngx_err_t;
|
||||
|
||||
#define NGX_ENOENT ENOENT
|
||||
#define NGX_ESRCH ESRCH
|
||||
#define NGX_EINTR EINTR
|
||||
#define NGX_ECHILD ECHILD
|
||||
#define NGX_EACCES EACCES
|
||||
|
@ -326,6 +326,7 @@ static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
|
||||
static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
|
||||
{
|
||||
ngx_uint_t i;
|
||||
ngx_err_t err;
|
||||
|
||||
for (i = 0; i < ngx_last_process; i++) {
|
||||
|
||||
@ -349,9 +350,17 @@ static void ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo)
|
||||
ngx_processes[i].pid, signo);
|
||||
|
||||
if (kill(ngx_processes[i].pid, signo) == -1) {
|
||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
||||
err = ngx_errno;
|
||||
ngx_log_error(NGX_LOG_ALERT, cycle->log, err,
|
||||
"kill(%d, %d) failed",
|
||||
ngx_processes[i].pid, signo);
|
||||
|
||||
if (err == NGX_ESRCH) {
|
||||
ngx_processes[i].exited = 1;
|
||||
ngx_processes[i].exiting = 0;
|
||||
ngx_reap = 1;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -368,6 +377,8 @@ static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exit");
|
||||
|
||||
ngx_destroy_pool(cycle->pool);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -375,7 +386,7 @@ static void ngx_master_exit(ngx_cycle_t *cycle, ngx_master_ctx_t *ctx)
|
||||
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
|
||||
{
|
||||
sigset_t set;
|
||||
ngx_uint_t i;
|
||||
ngx_uint_t i, exiting;
|
||||
ngx_listening_t *ls;
|
||||
ngx_core_conf_t *ccf;
|
||||
#if (NGX_THREADS)
|
||||
@ -463,13 +474,22 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
|
||||
|
||||
#endif
|
||||
|
||||
exiting = 0;
|
||||
|
||||
for ( ;; ) {
|
||||
if (exiting && ngx_event_timer_rbtree == &ngx_event_timer_sentinel) {
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
|
||||
ngx_destroy_pool(cycle->pool);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
|
||||
|
||||
ngx_process_events(cycle);
|
||||
|
||||
if (ngx_terminate) {
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
|
||||
ngx_destroy_pool(cycle->pool);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -477,27 +497,12 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0,
|
||||
"gracefully shutting down");
|
||||
ngx_setproctitle("worker process is shutting down");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ngx_reopen) {
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs");
|
||||
ngx_reopen_files(cycle, -1);
|
||||
ngx_reopen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exiting) {
|
||||
ngx_close_listening_sockets(cycle);
|
||||
|
||||
for ( ;; ) {
|
||||
if (ngx_event_timer_rbtree == &ngx_event_timer_sentinel) {
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "exiting");
|
||||
exit(0);
|
||||
exiting = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "worker cycle");
|
||||
|
||||
ngx_process_events(cycle);
|
||||
|
||||
if (ngx_reopen) {
|
||||
ngx_log_error(NGX_LOG_INFO, cycle->log, 0, "reopen logs");
|
||||
|
Loading…
Reference in New Issue
Block a user