diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-07-09 15:37:31 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-07-09 15:37:31 +0000 |
commit | 14f279e7e5cad1d6da9f457ac26b8305bc22a3ee (patch) | |
tree | 6ad520e4c4a6d322c6a47c58e699fb309a24dc4f /src | |
parent | e739eb7281e782ad944671002e51d0ba562c732c (diff) | |
download | nginx-14f279e7e5cad1d6da9f457ac26b8305bc22a3ee.tar.gz nginx-14f279e7e5cad1d6da9f457ac26b8305bc22a3ee.zip |
nginx-0.0.7-2004-07-09-19:37:31 import
Diffstat (limited to 'src')
-rw-r--r-- | src/event/modules/ngx_kqueue_module.c | 54 | ||||
-rw-r--r-- | src/http/modules/ngx_http_ssl_filter.c | 2 | ||||
-rw-r--r-- | src/http/ngx_http_request.c | 2 |
3 files changed, 33 insertions, 25 deletions
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c index 9bc0a604c..dbf86ff70 100644 --- a/src/event/modules/ngx_kqueue_module.c +++ b/src/event/modules/ngx_kqueue_module.c @@ -45,7 +45,8 @@ static struct kevent *event_list; static int max_changes, nchanges, nevents; #if (NGX_THREADS) -static ngx_mutex_t *ngx_kqueue_mutex; +static ngx_mutex_t *list_mutex; +static ngx_mutex_t *kevent_mutex; #endif @@ -120,9 +121,15 @@ static ngx_int_t ngx_kqueue_init(ngx_cycle_t *cycle) } #if (NGX_THREADS) - if (!(ngx_kqueue_mutex = ngx_mutex_init(cycle->log, 0))) { + + if (!(list_mutex = ngx_mutex_init(cycle->log, 0))) { + return NGX_ERROR; + } + + if (!(kevent_mutex = ngx_mutex_init(cycle->log, 0))) { return NGX_ERROR; } + #endif } @@ -206,7 +213,8 @@ static void ngx_kqueue_done(ngx_cycle_t *cycle) ngx_kqueue = -1; #if (NGX_THREADS) - ngx_mutex_destroy(ngx_kqueue_mutex); + ngx_mutex_destroy(kevent_mutex); + ngx_mutex_destroy(list_mutex); #endif ngx_free(change_list1); @@ -233,7 +241,7 @@ static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) ev->disabled = 0; ev->oneshot = (flags & NGX_ONESHOT_EVENT) ? 1 : 0; - if (ngx_mutex_lock(ngx_kqueue_mutex) == NGX_ERROR) { + if (ngx_mutex_lock(list_mutex) == NGX_ERROR) { return NGX_ERROR; } @@ -259,7 +267,7 @@ static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) e->index = ev->index; } - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return NGX_OK; } @@ -269,14 +277,14 @@ static ngx_int_t ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags) ngx_log_error(NGX_LOG_ALERT, ev->log, 0, "previous event on #%d were not passed in kernel", c->fd); - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return NGX_ERROR; } rc = ngx_kqueue_set_event(ev, event, EV_ADD|EV_ENABLE|flags); - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return rc; } @@ -290,7 +298,7 @@ static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags) ev->active = 0; ev->disabled = 0; - if (ngx_mutex_lock(ngx_kqueue_mutex) == NGX_ERROR) { + if (ngx_mutex_lock(list_mutex) == NGX_ERROR) { return NGX_ERROR; } @@ -311,7 +319,7 @@ static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags) e->index = ev->index; } - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return NGX_OK; } @@ -323,7 +331,7 @@ static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags) */ if (flags & NGX_CLOSE_EVENT) { - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return NGX_OK; } @@ -334,7 +342,7 @@ static ngx_int_t ngx_kqueue_del_event(ngx_event_t *ev, int event, u_int flags) rc = ngx_kqueue_set_event(ev, event, flags & NGX_DISABLE_EVENT ? EV_DISABLE : EV_DELETE); - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); return rc; } @@ -704,24 +712,22 @@ static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try) struct timespec ts; struct kevent *changes; - if (try) { - rc = ngx_mutex_trylock(ngx_kqueue_mutex); - if (rc != NGX_OK) { - return rc; - } + if (ngx_mutex_lock(kevent_mutex) == NGX_ERROR) { + return NGX_ERROR; + } - } else { - if (ngx_mutex_lock(ngx_kqueue_mutex) == NGX_ERROR) { - return NGX_ERROR; - } + if (ngx_mutex_lock(list_mutex) == NGX_ERROR) { + ngx_mutex_unlock(kevent_mutex); + return NGX_ERROR; } if (nchanges == 0) { - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(list_mutex); + ngx_mutex_unlock(kevent_mutex); return NGX_OK; } - changes = (struct kevent *) change_list; + changes = change_list; if (change_list == change_list0) { change_list = change_list1; } else { @@ -731,6 +737,8 @@ static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try) n = nchanges; nchanges = 0; + ngx_mutex_unlock(list_mutex); + ts.tv_sec = 0; ts.tv_nsec = 0; @@ -747,7 +755,7 @@ static ngx_int_t ngx_kqueue_process_changes(ngx_cycle_t *cycle, ngx_uint_t try) rc = NGX_OK; } - ngx_mutex_unlock(ngx_kqueue_mutex); + ngx_mutex_unlock(kevent_mutex); return rc; } diff --git a/src/http/modules/ngx_http_ssl_filter.c b/src/http/modules/ngx_http_ssl_filter.c index b39fc38d5..5370426bb 100644 --- a/src/http/modules/ngx_http_ssl_filter.c +++ b/src/http/modules/ngx_http_ssl_filter.c @@ -199,7 +199,7 @@ static ngx_http_ssl_ctx_t *ngx_http_ssl_create_ctx(ngx_http_request_t *r) void ngx_http_ssl_close_request(SSL *ssl, int mode) { SSL_set_shutdown(ssl, mode); - SSL_smart_shutdown(ssl); + SSL_shutdown(ssl); SSL_free(ssl); } diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 9e2cb89d6..4c1783412 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -815,7 +815,7 @@ static ssize_t ngx_http_read_request_header(ngx_http_request_t *r) return NGX_AGAIN; } -#if 1 +#if 0 ngx_http_ssl_read(r); #else n = ngx_recv(r->connection, r->header_in->last, |