diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-06-28 21:03:14 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-06-28 21:03:14 +0000 |
commit | 0a94cfd2ae9ca87b4d988b5066f739a3034f3bff (patch) | |
tree | e212b04fb2cb88f5f0accb9086a5c9eb3b9cd56e /src/http/ngx_http_request.c | |
parent | b14b91020284baf090b40bdb6ba87b99751f27fb (diff) | |
download | nginx-0a94cfd2ae9ca87b4d988b5066f739a3034f3bff.tar.gz nginx-0a94cfd2ae9ca87b4d988b5066f739a3034f3bff.zip |
nginx-0.0.7-2004-06-29-01:03:14 import
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 4bff8cc8a..fe1eaabcc 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1708,6 +1708,8 @@ void ngx_http_close_request(ngx_http_request_t *r, int error) 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); @@ -1737,16 +1739,25 @@ void ngx_http_close_connection(ngx_connection_t *c) } } - if (ngx_close_socket(c->fd) == -1) { - ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, - ngx_close_socket_n " failed"); - } + fd = c->fd; c->fd = (ngx_socket_t) -1; c->data = NULL; - ngx_destroy_pool(c->pool); + /* + * we has to clean the connection before the closing because another thread + * may reopen the same file descriptor before we clean the connection + */ + + 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; } |