diff src/event/ngx_event.c @ 236:c982febb7588 NGINX_0_4_3

nginx 0.4.3 *) Change: now the 499 error could not be redirected using an "error_page" directive. *) Feature: the Solaris 10 event ports support. *) Feature: the ngx_http_browser_module. *) Bugfix: a segmentation fault may occur while redirecting the 400 error to the proxied server using an "proxy_pass" directive. *) Bugfix: a segmentation fault occurred if an unix domain socket was used in an "proxy_pass" directive; bug appeared in 0.3.47. *) Bugfix: SSI did work with memcached and nonbuffered responses. *) Workaround: of the Sun Studio PAUSE hardware capability bug.
author Igor Sysoev <http://sysoev.ru>
date Tue, 26 Sep 2006 00:00:00 +0400
parents fa32d59d9a15
children 6ae1357b7b7c
line wrap: on
line diff
--- a/src/event/ngx_event.c
+++ b/src/event/ngx_event.c
@@ -13,6 +13,7 @@
 
 
 extern ngx_module_t ngx_kqueue_module;
+extern ngx_module_t ngx_eventport_module;
 extern ngx_module_t ngx_devpoll_module;
 extern ngx_module_t ngx_epoll_module;
 extern ngx_module_t ngx_rtsig_module;
@@ -49,6 +50,7 @@ ngx_atomic_t         *ngx_connection_cou
 ngx_atomic_t         *ngx_accept_mutex_ptr;
 ngx_shmtx_t           ngx_accept_mutex;
 ngx_uint_t            ngx_use_accept_mutex;
+ngx_uint_t            ngx_accept_events;
 ngx_uint_t            ngx_accept_mutex_held;
 ngx_msec_t            ngx_accept_mutex_delay;
 ngx_int_t             ngx_accept_disabled;
@@ -314,19 +316,25 @@ ngx_handle_read_event(ngx_event_t *rev, 
             return NGX_OK;
         }
 
-    } else if (ngx_event_flags & NGX_USE_ONESHOT_EVENT) {
+    } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
 
         /* event ports */
 
-        if (!rev->active) {
-            if (ngx_add_event(rev, NGX_READ_EVENT, NGX_ONESHOT_EVENT)
-                == NGX_ERROR)
-            {
+        if (!rev->active && !rev->ready) {
+            if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
                 return NGX_ERROR;
             }
+
+            return NGX_OK;
         }
 
-        return NGX_OK;
+        if (rev->oneshot && !rev->ready) {
+            if (ngx_del_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) {
+                return NGX_ERROR;
+            }
+
+            return NGX_OK;
+        }
     }
 
     /* aio, iocp, rtsig */
@@ -341,7 +349,7 @@ ngx_handle_write_event(ngx_event_t *wev,
     ngx_connection_t  *c;
 
     if (lowat) {
-        c = (ngx_connection_t *) wev->data;
+        c = wev->data;
 
         if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
             return NGX_ERROR;
@@ -387,19 +395,25 @@ ngx_handle_write_event(ngx_event_t *wev,
             return NGX_OK;
         }
 
-    } else if (ngx_event_flags & NGX_USE_ONESHOT_EVENT) {
+    } else if (ngx_event_flags & NGX_USE_EVENTPORT_EVENT) {
 
         /* event ports */
 
-        if (!wev->active) {
-            if (ngx_add_event(wev, NGX_WRITE_EVENT, NGX_ONESHOT_EVENT)
-                == NGX_ERROR)
-            {
+        if (!wev->active && !wev->ready) {
+            if (ngx_add_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
                 return NGX_ERROR;
             }
+
+            return NGX_OK;
         }
 
-        return NGX_OK;
+        if (wev->oneshot && wev->ready) {
+            if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) == NGX_ERROR) {
+                return NGX_ERROR;
+            }
+
+            return NGX_OK;
+        }
     }
 
     /* aio, iocp, rtsig */
@@ -1198,7 +1212,7 @@ ngx_event_init_conf(ngx_cycle_t *cycle, 
                 event_module = ngx_modules[i]->ctx;
 
                 if (ngx_strcmp(event_module->name->data, event_core_name.data)
-                                                                          == 0)
+                    == 0)
                 {
                     continue;
                 }