diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-07-02 05:47:00 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-07-02 05:47:00 +0000 |
commit | 46cd7c2a9bc740a2d3de03410dd84412b9d85856 (patch) | |
tree | a292c6b96f130845150ebf013011bece87f38cb9 /src/http/ngx_http_request.c | |
parent | 078d1b2c2263690f2f6b7217b567eeeb525910d0 (diff) | |
download | nginx-46cd7c2a9bc740a2d3de03410dd84412b9d85856.tar.gz nginx-46cd7c2a9bc740a2d3de03410dd84412b9d85856.zip |
nginx-0.0.7-2004-07-02-09:47:00 import
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r-- | src/http/ngx_http_request.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index fe1eaabcc..0063ee2bc 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -1739,16 +1739,31 @@ void ngx_http_close_connection(ngx_connection_t *c) } } - fd = c->fd; + /* + * we have to clean the connection information before the closing + * because another thread may reopen the same file descriptor + * before we clean the connection + */ + 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_THREADS) + + if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_OK) { + ngx_unlock(&c->lock); + c->read->locked = 0; + c->write->locked = 0; + + ngx_mutex_unlock(ngx_posted_events_mutex); + } + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, + "connection lock: %d " PTR_FMT, c->lock, &c->lock); + +#endif if (ngx_close_socket(fd) == -1) { |