mirror of
https://github.com/nginx/nginx.git
synced 2024-11-21 16:28:40 +00:00
nginx-0.0.1-2003-12-05-10:11:46 import
This commit is contained in:
parent
f5003d8a66
commit
faca119aa5
9
auto/cc
9
auto/cc
@ -95,8 +95,13 @@ case $CC in
|
||||
|
||||
# link flags
|
||||
CORE_LINK="$CORE_LINK -link"
|
||||
CORE_LINK="$CORE_LINK -nodefaultlib:msvcrt"
|
||||
CORE_LINK="$CORE_LINK -nodefaultlib:libcpmt"
|
||||
|
||||
# msvcrt.dll
|
||||
CORE_LINK="$CORE_LINK -nodefaultlib:libcmt"
|
||||
|
||||
# static libc
|
||||
#CORE_LINK="$CORE_LINK -nodefaultlib:msvcrt"
|
||||
|
||||
CORE_LINK="$CORE_LINK -verbose:lib"
|
||||
|
||||
# debug
|
||||
|
@ -35,6 +35,9 @@ case $PLATFORM in
|
||||
|
||||
CFLAGS="$CFLAGS -D HAVE_AIO=1 -D HAVE_IOCP=1"
|
||||
CORE_LIBS="$CORE_LIBS ws2_32.lib"
|
||||
|
||||
# msvcrt.dll
|
||||
CORE_LIBS="$CORE_LIBS msvcrt.lib"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
@ -8,12 +8,11 @@
|
||||
* to Algorithms" by Cormen, Leiserson and Rivest.
|
||||
*/
|
||||
|
||||
#define ngx_rbt_red(node) ((uintptr_t) (node)->data |= 1)
|
||||
#define ngx_rbt_black(node) ((uintptr_t) (node)->data &= ~1)
|
||||
#define ngx_rbt_is_red(node) ((uintptr_t) (node)->data & 1)
|
||||
#define ngx_rbt_red(node) ((node)->color = 1)
|
||||
#define ngx_rbt_black(node) ((node)->color = 0)
|
||||
#define ngx_rbt_is_red(node) ((node)->color)
|
||||
#define ngx_rbt_is_black(node) (!ngx_rbt_is_red(node))
|
||||
#define ngx_rbt_copy_color(n1, n2) \
|
||||
((uintptr_t) (n1)->data |= (uintptr_t) (n2)->data & 1)
|
||||
#define ngx_rbt_copy_color(n1, n2) (n1->color = n2->color)
|
||||
|
||||
|
||||
ngx_inline void ngx_rbtree_left_rotate(ngx_rbtree_t **root, ngx_rbtree_t *node);
|
||||
@ -166,7 +165,7 @@ void ngx_rbtree_delete(ngx_rbtree_t **root, ngx_rbtree_t *node)
|
||||
|
||||
if (subst != node) {
|
||||
node->key = subst->key;
|
||||
node->data = subst->data;
|
||||
node->color = subst->color;
|
||||
}
|
||||
|
||||
if (ngx_rbt_is_red(subst)) {
|
||||
|
@ -13,7 +13,7 @@ struct ngx_rbtree_s {
|
||||
ngx_rbtree_t *left;
|
||||
ngx_rbtree_t *right;
|
||||
ngx_rbtree_t *parent;
|
||||
void *data;
|
||||
char color;
|
||||
};
|
||||
|
||||
extern ngx_rbtree_t sentinel;
|
||||
|
@ -31,8 +31,6 @@ struct ngx_event_s {
|
||||
ngx_event_t *prev;
|
||||
ngx_event_t *next;
|
||||
|
||||
ngx_rbtree_t rbtree;
|
||||
|
||||
#if 0
|
||||
ngx_event_t *timer_prev;
|
||||
ngx_event_t *timer_next;
|
||||
@ -42,6 +40,69 @@ struct ngx_event_s {
|
||||
|
||||
ngx_log_t *log;
|
||||
|
||||
/*
|
||||
* ngx_rbtree_t rbtree;
|
||||
*/
|
||||
|
||||
ngx_int_t rbtree_key;
|
||||
void *rbtree_left;
|
||||
void *rbtree_right;
|
||||
void *rbtree_parent;
|
||||
char rbtree_color;
|
||||
|
||||
unsigned char oneshot:1;
|
||||
|
||||
unsigned char write:1;
|
||||
|
||||
/* used to detect the stale events in kqueue, rt signals and epoll */
|
||||
unsigned char instance:1;
|
||||
|
||||
/*
|
||||
* the event was passed or would be passed to a kernel;
|
||||
* in aio mode - operation was posted.
|
||||
*/
|
||||
unsigned char active:1;
|
||||
|
||||
/* the ready event; in aio mode 0 means that no operation can be posted */
|
||||
unsigned char ready:1;
|
||||
|
||||
/* aio operation is complete */
|
||||
unsigned char complete:1;
|
||||
|
||||
unsigned char eof:1;
|
||||
unsigned char error:1;
|
||||
|
||||
unsigned short timedout:1;
|
||||
unsigned short timer_set:1;
|
||||
|
||||
unsigned short delayed:1;
|
||||
|
||||
unsigned short read_discarded:1;
|
||||
|
||||
unsigned short ignore_econnreset:1;
|
||||
unsigned short unexpected_eof:1;
|
||||
|
||||
unsigned short deferred_accept:1;
|
||||
|
||||
/* TODO: aio_eof and kq_eof can be the single pending_eof */
|
||||
/* the pending eof in aio chain operation */
|
||||
unsigned short aio_eof:1;
|
||||
|
||||
/* the pending eof reported by kqueue */
|
||||
unsigned short kq_eof:1;
|
||||
|
||||
#if (WIN32)
|
||||
/* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was succesfull */
|
||||
unsigned short accept_context_updated:1;
|
||||
#endif
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
unsigned short kq_vnode:1;
|
||||
|
||||
/* the pending errno reported by kqueue */
|
||||
int kq_errno;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* kqueue only:
|
||||
* accept: number of sockets that wait to be accepted
|
||||
@ -57,60 +118,7 @@ struct ngx_event_s {
|
||||
#if (HAVE_KQUEUE)
|
||||
int available;
|
||||
#else
|
||||
unsigned available:1;
|
||||
#endif
|
||||
|
||||
unsigned oneshot:1;
|
||||
|
||||
unsigned write:1;
|
||||
|
||||
/* used to detect the stale events in kqueue, rt signals and epoll */
|
||||
unsigned instance:1;
|
||||
|
||||
/*
|
||||
* the event was passed or would be passed to a kernel;
|
||||
* in aio mode - operation was posted.
|
||||
*/
|
||||
unsigned active:1;
|
||||
|
||||
/* the ready event; in aio mode 0 means that no operation can be posted */
|
||||
unsigned ready:1;
|
||||
|
||||
/* aio operation is complete */
|
||||
unsigned complete:1;
|
||||
|
||||
unsigned eof:1;
|
||||
unsigned error:1;
|
||||
|
||||
unsigned timedout:1;
|
||||
unsigned timer_set:1;
|
||||
|
||||
unsigned delayed:1;
|
||||
|
||||
unsigned read_discarded:1;
|
||||
|
||||
unsigned ignore_econnreset:1;
|
||||
unsigned unexpected_eof:1;
|
||||
|
||||
unsigned deferred_accept:1;
|
||||
|
||||
/* TODO: aio_eof and kq_eof can be the single pending_eof */
|
||||
/* the pending eof in aio chain operation */
|
||||
unsigned aio_eof:1;
|
||||
|
||||
/* the pending eof reported by kqueue */
|
||||
unsigned kq_eof:1;
|
||||
|
||||
#if (WIN32)
|
||||
/* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was succesfull */
|
||||
unsigned accept_context_updated:1;
|
||||
#endif
|
||||
|
||||
#if (HAVE_KQUEUE)
|
||||
unsigned kq_vnode:1;
|
||||
|
||||
/* the pending errno reported by kqueue */
|
||||
int kq_errno;
|
||||
unsigned short available:1;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -175,9 +175,6 @@ void ngx_event_accept(ngx_event_t *ev)
|
||||
rev->index = NGX_INVALID_INDEX;
|
||||
wev->index = NGX_INVALID_INDEX;
|
||||
|
||||
rev->rbtree.data = rev;
|
||||
wev->rbtree.data = wev;
|
||||
|
||||
rev->data = c;
|
||||
wev->data = c;
|
||||
|
||||
|
@ -23,7 +23,7 @@ void ngx_event_timer_done(ngx_cycle_t *cycle)
|
||||
}
|
||||
|
||||
|
||||
int ngx_event_find_timer(void)
|
||||
ngx_msec_t ngx_event_find_timer(void)
|
||||
{
|
||||
ngx_rbtree_t *node;
|
||||
|
||||
@ -33,7 +33,8 @@ int ngx_event_find_timer(void)
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
return node->key * NGX_TIMER_RESOLUTION - ngx_elapsed_msec;
|
||||
return (ngx_msec_t)
|
||||
(node->key * NGX_TIMER_RESOLUTION - ngx_elapsed_msec);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,11 +51,11 @@ void ngx_event_expire_timers(ngx_msec_t timer)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ngx_msec_t) node->key <=
|
||||
if ((ngx_msec_t) node->key <= (ngx_msec_t)
|
||||
(ngx_elapsed_msec + timer) / NGX_TIMER_RESOLUTION)
|
||||
{
|
||||
ev = (ngx_event_t *)
|
||||
((char *) node - offsetof(ngx_event_t, rbtree));
|
||||
((char *) node - offsetof(ngx_event_t, rbtree_key));
|
||||
|
||||
ngx_del_timer(ev);
|
||||
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
|
||||
/*
|
||||
* 32 bit key value resolution
|
||||
*
|
||||
* 1 msec - 49 days
|
||||
* 10 msec - 1 years 4 months
|
||||
* 50 msec - 6 years 10 months
|
||||
@ -19,7 +21,7 @@
|
||||
|
||||
int ngx_event_timer_init(ngx_cycle_t *cycle);
|
||||
void ngx_event_timer_done(ngx_cycle_t *cycle);
|
||||
int ngx_event_find_timer(void);
|
||||
ngx_msec_t ngx_event_find_timer(void);
|
||||
void ngx_event_expire_timers(ngx_msec_t timer);
|
||||
|
||||
#if 0
|
||||
@ -37,7 +39,8 @@ extern ngx_rbtree_t *ngx_event_timer_rbtree;
|
||||
|
||||
ngx_inline static void ngx_event_del_timer(ngx_event_t *ev)
|
||||
{
|
||||
ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->rbtree);
|
||||
ngx_rbtree_delete(&ngx_event_timer_rbtree,
|
||||
(ngx_rbtree_t *) &ev->rbtree_key);
|
||||
|
||||
ev->timer_set = 0;
|
||||
}
|
||||
@ -49,10 +52,11 @@ ngx_inline static void ngx_event_add_timer(ngx_event_t *ev, ngx_msec_t timer)
|
||||
ngx_del_timer(ev);
|
||||
}
|
||||
|
||||
ev->rbtree.key = (ngx_int_t)
|
||||
ev->rbtree_key = (ngx_int_t)
|
||||
(ngx_elapsed_msec + timer) / NGX_TIMER_RESOLUTION;
|
||||
|
||||
ngx_rbtree_insert(&ngx_event_timer_rbtree, &ev->rbtree);
|
||||
ngx_rbtree_insert(&ngx_event_timer_rbtree,
|
||||
(ngx_rbtree_t *) &ev->rbtree_key);
|
||||
|
||||
ev->timer_set = 1;
|
||||
}
|
||||
|
@ -514,7 +514,13 @@ ngx_log_debug(r->connection->log, "trans: %s: %d" _
|
||||
}
|
||||
|
||||
if (clcf->handler) {
|
||||
/*
|
||||
* if the location already has content handler then skip
|
||||
* the translation phase
|
||||
*/
|
||||
|
||||
r->content_handler = clcf->handler;
|
||||
r->phase++;
|
||||
}
|
||||
|
||||
return NGX_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user