summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-12-07 14:46:21 +0000
committerJonathan Kolb <jon@b0g.us>2005-12-07 14:46:21 +0000
commitf962860d0dd4038450aaae5c3b5f94d68f192cab (patch)
tree56d606cef5954794f18b9c04e071cb0083291eef /src/os
parent1e8b202b5767ac9f14d1ee5aff3ab55f250bbec5 (diff)
downloadnginx-f962860d0dd4038450aaae5c3b5f94d68f192cab.tar.gz
Changes with nginx 0.3.15 07 Dec 2005v0.3.15
*) Feature: the new 444 code of the "return" directive to close connection. *) Feature: the "so_keepalive" directive in IMAP/POP3 proxy. *) Bugfix: if there are unclosed connection nginx now calls abort() only on gracefull quit and active "debug_points" directive.
Diffstat (limited to 'src/os')
-rw-r--r--src/os/unix/ngx_freebsd_sendfile_chain.c6
-rw-r--r--src/os/unix/ngx_process_cycle.c32
-rw-r--r--src/os/unix/ngx_readv_chain.c23
-rw-r--r--src/os/unix/ngx_recv.c14
-rw-r--r--src/os/unix/ngx_send.c6
-rw-r--r--src/os/unix/ngx_writev_chain.c6
6 files changed, 35 insertions, 52 deletions
diff --git a/src/os/unix/ngx_freebsd_sendfile_chain.c b/src/os/unix/ngx_freebsd_sendfile_chain.c
index 662b3347b..7ae594897 100644
--- a/src/os/unix/ngx_freebsd_sendfile_chain.c
+++ b/src/os/unix/ngx_freebsd_sendfile_chain.c
@@ -56,11 +56,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
#if (NGX_HAVE_KQUEUE)
- if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT)
- && wev->pending_eof
- /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
- && wev->kq_errno != NGX_ETIMEDOUT)
- {
+ if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
(void) ngx_connection_error(c, wev->kq_errno,
"kevent() reported about an closed connection");
wev->error = 1;
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 7adcc6ef7..14bbe80b2 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -938,23 +938,25 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
}
}
- c = cycle->connections;
- for (i = 0; i < cycle->connection_n; i++) {
- if (c[i].fd != -1
- && c[i].read
- && !c[i].read->accept
- && !c[i].read->channel)
- {
- ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
- "open socket #%d left in %ui connection, "
- "aborting",
- c[i].fd, i);
- ngx_abort();
+ if (ngx_quit) {
+ c = cycle->connections;
+ for (i = 0; i < cycle->connection_n; i++) {
+ if (c[i].fd != -1
+ && c[i].read
+ && !c[i].read->accept
+ && !c[i].read->channel)
+ {
+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
+ "open socket #%d left in %ui connection, "
+ "aborting",
+ c[i].fd, i);
+ ngx_debug_point();
+ }
}
- }
- if (ngx_debug_quit) {
- ngx_debug_point();
+ if (ngx_debug_quit) {
+ ngx_debug_point();
+ }
}
/*
diff --git a/src/os/unix/ngx_readv_chain.c b/src/os/unix/ngx_readv_chain.c
index 0e99cb413..b55e2f27e 100644
--- a/src/os/unix/ngx_readv_chain.c
+++ b/src/os/unix/ngx_readv_chain.c
@@ -32,26 +32,23 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
rev->pending_eof, rev->available, rev->kq_errno);
if (rev->available == 0) {
-
- if (!rev->pending_eof) {
- return NGX_AGAIN;
- }
-
- /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
- if (rev->kq_errno != NGX_ETIMEDOUT) {
-
+ if (rev->pending_eof) {
rev->ready = 0;
rev->eof = 1;
+ ngx_log_error(NGX_LOG_INFO, c->log, rev->kq_errno,
+ "kevent() reported about an closed connection");
+
if (rev->kq_errno) {
rev->error = 1;
ngx_set_socket_errno(rev->kq_errno);
-
- return ngx_connection_error(c, rev->kq_errno,
- "kevent() reported about an closed connection");
+ return NGX_ERROR;
}
return 0;
+
+ } else {
+ return NGX_AGAIN;
}
}
}
@@ -100,8 +97,8 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain)
rev->available -= n;
/*
- * rev->available can be negative here because some additional
- * bytes can be received between kevent() and recv()
+ * rev->available may be negative here because some additional
+ * bytes may be received between kevent() and recv()
*/
if (rev->available <= 0) {
diff --git a/src/os/unix/ngx_recv.c b/src/os/unix/ngx_recv.c
index a9064307a..0d3872969 100644
--- a/src/os/unix/ngx_recv.c
+++ b/src/os/unix/ngx_recv.c
@@ -25,14 +25,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
rev->pending_eof, rev->available, rev->kq_errno);
if (rev->available == 0) {
-
- if (!rev->pending_eof) {
- return NGX_AGAIN;
- }
-
- /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
- if (rev->kq_errno != NGX_ETIMEDOUT) {
-
+ if (rev->pending_eof) {
rev->ready = 0;
rev->eof = 1;
@@ -45,6 +38,9 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
}
return 0;
+
+ } else {
+ return NGX_AGAIN;
}
}
}
@@ -61,7 +57,7 @@ ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size)
/*
* rev->available may be negative here because some additional
- * bytes can be received between kevent() and recv()
+ * bytes may be received between kevent() and recv()
*/
if (rev->available <= 0) {
diff --git a/src/os/unix/ngx_send.c b/src/os/unix/ngx_send.c
index 0c3f959da..167f2eca3 100644
--- a/src/os/unix/ngx_send.c
+++ b/src/os/unix/ngx_send.c
@@ -19,11 +19,7 @@ ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size)
#if (NGX_HAVE_KQUEUE)
- if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT)
- && wev->pending_eof
- /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
- && wev->kq_errno != NGX_ETIMEDOUT)
- {
+ if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
(void) ngx_connection_error(c, wev->kq_errno,
"kevent() reported about an closed connection");
wev->error = 1;
diff --git a/src/os/unix/ngx_writev_chain.c b/src/os/unix/ngx_writev_chain.c
index 09e08e108..f95c2cad8 100644
--- a/src/os/unix/ngx_writev_chain.c
+++ b/src/os/unix/ngx_writev_chain.c
@@ -33,11 +33,7 @@ ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
#if (NGX_HAVE_KQUEUE)
- if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT)
- && wev->pending_eof
- /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
- && wev->kq_errno != NGX_ETIMEDOUT)
- {
+ if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) && wev->pending_eof) {
(void) ngx_connection_error(c, wev->kq_errno,
"kevent() reported about an closed connection");
wev->error = 1;