diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-09-07 15:29:22 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-09-07 15:29:22 +0000 |
commit | 59cf56c5d975725be9e2adc84170ffe0c638fa48 (patch) | |
tree | d355ce8975bbcacc29cdf54ffac45c84b55649a0 /src/http/ngx_http_request.c | |
parent | aab4d8c0c4aa068cc7ddcb1c5daee330d9dec47a (diff) | |
download | nginx-59cf56c5d975725be9e2adc84170ffe0c638fa48.tar.gz nginx-59cf56c5d975725be9e2adc84170ffe0c638fa48.zip |
nginx-0.0.10-2004-09-07-19:29:22 import
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 101 |
1 files changed, 1 insertions, 100 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 52c7c4256..dcf53d746 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1899,109 +1899,10 @@ void ngx_ssl_close_handler(ngx_event_t *ev) void ngx_http_close_connection(ngx_connection_t *c) { - ngx_socket_t fd; - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "close http connection: %d", c->fd); - if (c->pool == NULL) { - ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); - return; - } - -#if (NGX_HTTP_SSL) - - if (c->ssl) { - if (ngx_ssl_shutdown(c) == NGX_AGAIN) { - c->read->event_handler = ngx_ssl_close_handler; - c->write->event_handler = ngx_ssl_close_handler; - return; - } - } - -#endif - - if (c->read->timer_set) { - ngx_del_timer(c->read); - } - - if (c->write->timer_set) { - ngx_del_timer(c->write); - } - - if (ngx_del_conn) { - ngx_del_conn(c, NGX_CLOSE_EVENT); - - } else { - if (c->read->active || c->read->disabled) { - ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); - } - - if (c->write->active || c->write->disabled) { - ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); - } - } - - /* - * we have to clean the connection information before the closing - * because another thread may reopen the same file descriptor - * before we clean the connection - */ - -#if (NGX_THREADS) - - if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_OK) { - - if (c->read->prev) { - ngx_delete_posted_event(c->read); - } - - if (c->write->prev) { - ngx_delete_posted_event(c->write); - } - - c->read->closed = 1; - c->write->closed = 1; - - if (c->single_connection) { - ngx_unlock(&c->lock); - c->read->locked = 0; - c->write->locked = 0; - } - - ngx_mutex_unlock(ngx_posted_events_mutex); - } - -#else - - if (c->read->prev) { - ngx_delete_posted_event(c->read); - } - - if (c->write->prev) { - ngx_delete_posted_event(c->write); - } - - c->read->closed = 1; - c->write->closed = 1; - -#endif - - fd = c->fd; - c->fd = (ngx_socket_t) -1; - c->data = NULL; - - ngx_destroy_pool(c->pool); - - if (ngx_close_socket(fd) == -1) { - - /* we use ngx_cycle->log because c->log was in c->pool */ - - ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_socket_errno, - ngx_close_socket_n " failed"); - } - - return; + ngx_close_connection(c); } |