changeset 230:1119faf4635a

nginx-0.0.1-2004-01-16-09:15:48 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 16 Jan 2004 06:15:48 +0000
parents ce6b72fe33fe
children 92db0aa1e83f
files src/event/modules/ngx_devpoll_module.c src/event/modules/ngx_kqueue_module.c src/event/modules/ngx_poll_module.c src/event/modules/ngx_select_module.c src/event/ngx_event.c src/event/ngx_event_timer.c src/event/ngx_event_timer.h src/http/ngx_http_request.c
diffstat 8 files changed, 16 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/modules/ngx_devpoll_module.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/modules/ngx_devpoll_module.c	Fri Jan 16 06:15:48 2004 +0000
@@ -165,10 +165,6 @@
 
     nevents = dpcf->events;
 
-    if (ngx_event_timer_init(cycle) == NGX_ERROR) {
-        return NGX_ERROR;
-    }
-
     ngx_io = ngx_os_io;
 
     ngx_event_actions = ngx_devpoll_module_ctx.actions;
@@ -188,8 +184,6 @@
 
     dp = -1;
 
-    ngx_event_timer_done(cycle);
-
     ngx_free(change_list);
     ngx_free(event_list);
     ngx_free(change_index);
--- a/src/event/modules/ngx_kqueue_module.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/modules/ngx_kqueue_module.c	Fri Jan 16 06:15:48 2004 +0000
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru/en/
+ * Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
  */
 
 
@@ -142,10 +142,6 @@
 
     nevents = kcf->events;
 
-    if (ngx_event_timer_init(cycle) == NGX_ERROR) {
-        return NGX_ERROR;
-    }
-
     ngx_io = ngx_os_io;
 
     ngx_event_actions = ngx_kqueue_module_ctx.actions;
@@ -174,8 +170,6 @@
 
     ngx_kqueue = -1;
 
-    ngx_event_timer_done(cycle);
-
     ngx_free(change_list);
     ngx_free(event_list);
 
--- a/src/event/modules/ngx_poll_module.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/modules/ngx_poll_module.c	Fri Jan 16 06:15:48 2004 +0000
@@ -101,10 +101,6 @@
                       NGX_ERROR);
     }
 
-    if (ngx_event_timer_init(cycle) == NGX_ERROR) {
-        return NGX_ERROR;
-    }
-
     ngx_io = ngx_os_io;
 
     ngx_event_actions = ngx_poll_module_ctx.actions;
@@ -117,8 +113,6 @@
 
 static void ngx_poll_done(ngx_cycle_t *cycle)
 {
-    ngx_event_timer_done(cycle);
-
     ngx_free(event_list);
     ngx_free(event_index);
     ngx_free(ready_index);
--- a/src/event/modules/ngx_select_module.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/modules/ngx_select_module.c	Fri Jan 16 06:15:48 2004 +0000
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (C) 2002-2003 Igor Sysoev, http://sysoev.ru
+ * Copyright (C) 2002-2004 Igor Sysoev, http://sysoev.ru/en/
  */
 
 
@@ -100,10 +100,6 @@
                       NGX_ERROR);
     }
 
-    if (ngx_event_timer_init(cycle) == NGX_ERROR) {
-        return NGX_ERROR;
-    }
-
     ngx_io = ngx_os_io;
 
     ngx_event_actions = ngx_select_module_ctx.actions;
@@ -122,8 +118,6 @@
 
 static void ngx_select_done(ngx_cycle_t *cycle)
 {
-    ngx_event_timer_done(cycle);
-
     ngx_free(event_index);
     ngx_free(ready_index);
 
@@ -262,6 +256,7 @@
     work_write_fd_set = master_write_fd_set;
 
     timer = ngx_event_find_timer();
+    ngx_old_elapsed_msec = ngx_elapsed_msec;
 
     if (timer) {
 #if (HAVE_SELECT_CHANGE_TIMEOUT)
--- a/src/event/ngx_event.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/ngx_event.c	Fri Jan 16 06:15:48 2004 +0000
@@ -120,10 +120,7 @@
 #endif
 
 
-    if (cycle->old_cycle == NULL) {
-        ngx_event_timer_init(cycle);
-    }
-
+    ngx_event_timer_init();
 
     ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module);
 
--- a/src/event/ngx_event_timer.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/ngx_event_timer.c	Fri Jan 16 06:15:48 2004 +0000
@@ -14,26 +14,13 @@
 ngx_rbtree_t   ngx_event_timer_sentinel;
 
 
-int ngx_event_timer_init(ngx_cycle_t *cycle)
+void ngx_event_timer_init(void)
 {
     if (ngx_event_timer_rbtree) {
-        return NGX_OK;
+        return;
     }
 
     ngx_event_timer_rbtree = &ngx_event_timer_sentinel;
-
-#if 0
-    ngx_event_timer_sentinel.left = &ngx_event_timer_sentinel;
-    ngx_event_timer_sentinel.right = &ngx_event_timer_sentinel;
-    ngx_event_timer_sentinel.parent = &ngx_event_timer_sentinel;
-#endif
-
-    return NGX_OK;
-}
-
-
-void ngx_event_timer_done(ngx_cycle_t *cycle)
-{
 }
 
 
--- a/src/event/ngx_event_timer.h	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/event/ngx_event_timer.h	Fri Jan 16 06:15:48 2004 +0000
@@ -19,12 +19,7 @@
 #define NGX_TIMER_RESOLUTION  1
 
 
-#if 0
-int  ngx_event_timer_init(void);
-#endif
-/* STUB */ int  ngx_event_timer_init(ngx_cycle_t *cycle);
-/* STUB */ void ngx_event_timer_done(ngx_cycle_t *cycle);
-
+void ngx_event_timer_init(void);
 ngx_msec_t ngx_event_find_timer(void);
 void ngx_event_expire_timers(ngx_msec_t timer);
 
--- a/src/http/ngx_http_request.c	Thu Jan 15 17:51:49 2004 +0000
+++ b/src/http/ngx_http_request.c	Fri Jan 16 06:15:48 2004 +0000
@@ -921,18 +921,21 @@
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (r->keepalive != 0 && clcf->keepalive_timeout > 0) {
+    if (!ngx_terminate
+         && !ngx_quit
+         && r->keepalive != 0
+         && clcf->keepalive_timeout > 0)
+    {
         ngx_http_set_keepalive(r);
+        return;
 
     } else if (r->lingering_close && clcf->lingering_timeout > 0) {
         ngx_http_set_lingering_close(r);
-
-    } else {
-        ngx_http_close_request(r, 0);
-        ngx_http_close_connection(r->connection);
+        return;
     }
 
-    return;
+    ngx_http_close_request(r, 0);
+    ngx_http_close_connection(r->connection);
 }