#else
ngx_event_flags = NGX_USE_LEVEL_EVENT
#endif
+ |NGX_HAVE_GREEDY_EVENT
|NGX_HAVE_INSTANCE_EVENT;
return NGX_OK;
continue;
}
-#if (NGX_DEBUG)
+#if (NGX_DEBUG0)
log = c->log ? c->log : cycle->log;
#endif
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;
}
*/
#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)
* 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.
*/
-#define NGX_USE_SIGIO_EVENT 0x00000080
+#define NGX_USE_SIGIO_EVENT 0x00000100
/*
* 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,
* 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.
* 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
#endif
len = sizeof(struct sockaddr_in);
if (getsockname(c->fd, (struct sockaddr *) &addr_in, &len) == -1) {
- ngx_log_error(NGX_LOG_CRIT, rev->log, ngx_socket_errno,
- "getsockname() failed");
+ ngx_connection_error(c, ngx_socket_errno,
+ "getsockname() failed");
ngx_http_close_connection(c);
return;
}
if (c->tcp_nopush == 1) {
if (ngx_tcp_push(c->fd) == NGX_ERROR) {
- ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
- ngx_tcp_push_n " failed");
- ngx_http_close_connection(c);
- return;
+ ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed");
+ ngx_http_close_connection(c);
+ return;
}
c->tcp_nopush = 0;
}
}
if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) {
- ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
- ngx_shutdown_socket_n " failed");
+ ngx_connection_error(c, ngx_socket_errno,
+ ngx_shutdown_socket_n " failed");
ngx_http_close_request(r, 0);
ngx_http_close_connection(c);
return;
do {
n = readv(c->fd, (struct iovec *) io.elts, io.nelts);
- if (n >= 0) {
- if (n < size) {
- rev->ready = 0;
- }
+ if (n == 0) {
+ rev->ready = 0;
+ rev->eof = 1;
- if (n == 0) {
- rev->eof = 1;
+ return n;
+
+ } else if (n > 0) {
+
+ if (n < size && !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT)) {
+ rev->ready = 0;
}
return n;
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
"recv: fd:%d %d of %d", c->fd, n, size);
- if (n >= 0) {
- if ((size_t) n < size) {
- rev->ready = 0;
- }
+ if (n == 0) {
+ rev->ready = 0;
+ rev->eof = 1;
+ return n;
- if (n == 0) {
- rev->eof = 1;
+ } else if (n > 0) {
+
+ if ((size_t) n < size
+ && !(ngx_event_flags & NGX_HAVE_GREEDY_EVENT))
+ {
+ rev->ready = 0;
}
return n;