nginx-0.0.3-2004-04-28-10:14:50 import

This commit is contained in:
Igor Sysoev 2004-04-28 06:14:50 +00:00
parent a30a028f14
commit 4cec79fb6a
6 changed files with 42 additions and 27 deletions

View File

@ -172,6 +172,7 @@ static int ngx_epoll_init(ngx_cycle_t *cycle)
#else #else
ngx_event_flags = NGX_USE_LEVEL_EVENT ngx_event_flags = NGX_USE_LEVEL_EVENT
#endif #endif
|NGX_HAVE_GREEDY_EVENT
|NGX_HAVE_INSTANCE_EVENT; |NGX_HAVE_INSTANCE_EVENT;
return NGX_OK; return NGX_OK;
@ -472,7 +473,7 @@ int ngx_epoll_process_events(ngx_cycle_t *cycle)
continue; continue;
} }
#if (NGX_DEBUG) #if (NGX_DEBUG0)
log = c->log ? c->log : cycle->log; log = c->log ? c->log : cycle->log;
#endif #endif

View File

@ -117,7 +117,9 @@ static int ngx_rtsig_init(ngx_cycle_t *cycle)
ngx_event_actions = ngx_rtsig_module_ctx.actions; ngx_event_actions = ngx_rtsig_module_ctx.actions;
ngx_event_flags = NGX_USE_SIGIO_EVENT|NGX_HAVE_INSTANCE_EVENT; ngx_event_flags = NGX_USE_SIGIO_EVENT
|NGX_HAVE_GREEDY_EVENT
|NGX_HAVE_INSTANCE_EVENT;
return NGX_OK; return NGX_OK;
} }

View File

@ -229,33 +229,39 @@ extern ngx_event_actions_t ngx_event_actions;
*/ */
#define NGX_HAVE_INSTANCE_EVENT 0x00000020 #define NGX_HAVE_INSTANCE_EVENT 0x00000020
/*
* The event filter requires to do i/o operation until EAGAIN -
* epoll, rt signals.
*/
#define NGX_HAVE_GREEDY_EVENT 0x00000040
/* /*
* The event filter notifies only the changes (the edges) * The event filter notifies only the changes (the edges)
* but not an initial level - early epoll patches. * but not an initial level - early epoll patches.
*/ */
#define NGX_USE_EDGE_EVENT 0x00000040 #define NGX_USE_EDGE_EVENT 0x00000080
/* /*
* No need to add or delete the event filters - rt signals. * No need to add or delete the event filters - rt signals.
*/ */
#define NGX_USE_SIGIO_EVENT 0x00000080 #define NGX_USE_SIGIO_EVENT 0x00000100
/* /*
* The alternative event method after the rt signals queue overflow. * The alternative event method after the rt signals queue overflow.
*/ */
#define NGX_OVERFLOW_EVENT 0x00000100 #define NGX_OVERFLOW_EVENT 0x00000200
/* /*
* No need to add or delete the event filters - overlapped, aio_read, * No need to add or delete the event filters - overlapped, aio_read,
* aioread, io_submit. * aioread, io_submit.
*/ */
#define NGX_USE_AIO_EVENT 0x00000200 #define NGX_USE_AIO_EVENT 0x00000400
/* /*
* Need to add socket or handle only once - i/o completion port. * Need to add socket or handle only once - i/o completion port.
* It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set. * It also requires HAVE_AIO and NGX_USE_AIO_EVENT to be set.
*/ */
#define NGX_USE_IOCP_EVENT 0x00000400 #define NGX_USE_IOCP_EVENT 0x00000800

View File

@ -192,8 +192,8 @@ static void ngx_http_init_request(ngx_event_t *rev)
#endif #endif
len = sizeof(struct sockaddr_in); len = sizeof(struct sockaddr_in);
if (getsockname(c->fd, (struct sockaddr *) &addr_in, &len) == -1) { if (getsockname(c->fd, (struct sockaddr *) &addr_in, &len) == -1) {
ngx_log_error(NGX_LOG_CRIT, rev->log, ngx_socket_errno, ngx_connection_error(c, ngx_socket_errno,
"getsockname() failed"); "getsockname() failed");
ngx_http_close_connection(c); ngx_http_close_connection(c);
return; return;
} }
@ -1306,10 +1306,9 @@ static void ngx_http_set_keepalive(ngx_http_request_t *r)
if (c->tcp_nopush == 1) { if (c->tcp_nopush == 1) {
if (ngx_tcp_push(c->fd) == NGX_ERROR) { if (ngx_tcp_push(c->fd) == NGX_ERROR) {
ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed");
ngx_tcp_push_n " failed"); ngx_http_close_connection(c);
ngx_http_close_connection(c); return;
return;
} }
c->tcp_nopush = 0; c->tcp_nopush = 0;
} }
@ -1415,8 +1414,8 @@ static void ngx_http_set_lingering_close(ngx_http_request_t *r)
} }
if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) { if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, ngx_connection_error(c, ngx_socket_errno,
ngx_shutdown_socket_n " failed"); ngx_shutdown_socket_n " failed");
ngx_http_close_request(r, 0); ngx_http_close_request(r, 0);
ngx_http_close_connection(c); ngx_http_close_connection(c);
return; return;

View File

@ -173,13 +173,16 @@ ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
do { do {
n = readv(c->fd, (struct iovec *) io.elts, io.nelts); n = readv(c->fd, (struct iovec *) io.elts, io.nelts);
if (n >= 0) { if (n == 0) {
if (n < size) { rev->ready = 0;
rev->ready = 0; rev->eof = 1;
}
if (n == 0) { return n;
rev->eof = 1;
} else if (n > 0) {
if (n < size && !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT)) {
rev->ready = 0;
} }
return n; return n;

View File

@ -126,13 +126,17 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
"recv: fd:%d %d of %d", c->fd, n, size); "recv: fd:%d %d of %d", c->fd, n, size);
if (n >= 0) { if (n == 0) {
if ((size_t) n < size) { rev->ready = 0;
rev->ready = 0; rev->eof = 1;
} return n;
if (n == 0) { } else if (n > 0) {
rev->eof = 1;
if ((size_t) n < size
&& !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT))
{
rev->ready = 0;
} }
return n; return n;