From b5910d497e51bac754b0a5bdbd58318b653e0859 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 30 Oct 2003 16:51:33 +0000 Subject: [PATCH] nginx-0.0.1-2003-10-30-19:51:33 import --- src/core/ngx_conf_file.c | 2 +- src/core/ngx_hunk.c | 2 +- src/core/ngx_hunk.h | 6 +++--- src/core/ngx_output_chain.c | 3 ++- src/event/modules/ngx_devpoll_module.c | 2 +- src/event/ngx_event_connect.c | 26 +++++++++++++++++++++----- src/os/unix/ngx_solaris_config.h | 1 + 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c index 5818636a8..60d68a06c 100644 --- a/src/core/ngx_conf_file.c +++ b/src/core/ngx_conf_file.c @@ -741,7 +741,7 @@ char *ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } bufs->size = ngx_parse_size(&value[2]); - if (bufs->size == NGX_ERROR || bufs->size == 0) { + if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) { return "invalid value"; } diff --git a/src/core/ngx_hunk.c b/src/core/ngx_hunk.c index 3799cef78..de57a5d02 100644 --- a/src/core/ngx_hunk.c +++ b/src/core/ngx_hunk.c @@ -115,7 +115,7 @@ void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy, *out = NULL; while (*busy) { - if (ngx_hunk_size((*busy)->hunk) > 0) { + if (ngx_hunk_size((*busy)->hunk) != 0) { break; } diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h index 3de78aa20..e68ba6d22 100644 --- a/src/core/ngx_hunk.h +++ b/src/core/ngx_hunk.h @@ -67,7 +67,7 @@ struct ngx_chain_s { typedef struct { int num; - ssize_t size; + size_t size; } ngx_bufs_t; @@ -117,8 +117,8 @@ typedef struct { #define ngx_hunk_size(h) \ - ((h->type & NGX_HUNK_IN_MEMORY) ? h->last - h->pos: \ - (size_t) (h->file_last - h->file_pos)) + ((h->type & NGX_HUNK_IN_MEMORY) ? (size_t) (h->last - h->pos): \ + (size_t) (h->file_last - h->file_pos)) ngx_hunk_t *ngx_create_temp_hunk(ngx_pool_t *pool, int size); diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c index b50cf9074..69ed5bc55 100644 --- a/src/core/ngx_output_chain.c +++ b/src/core/ngx_output_chain.c @@ -16,7 +16,8 @@ static int ngx_output_chain_copy_hunk(ngx_hunk_t *dst, ngx_hunk_t *src, int ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) { int rc, last; - ssize_t size, hsize; + size_t hsize; + ssize_t size; ngx_chain_t *cl, *out, **last_out; /* diff --git a/src/event/modules/ngx_devpoll_module.c b/src/event/modules/ngx_devpoll_module.c index c21abde0d..d652ac297 100644 --- a/src/event/modules/ngx_devpoll_module.c +++ b/src/event/modules/ngx_devpoll_module.c @@ -41,7 +41,7 @@ static int ngx_devpoll_process_events(ngx_log_t *log); static void *ngx_devpoll_create_conf(ngx_cycle_t *cycle); static char *ngx_devpoll_init_conf(ngx_cycle_t *cycle, void *conf); -static int dp; +static int dp = -1; static struct pollfd *change_list, *event_list; static u_int nchanges, max_changes, nevents; diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c index c697c1be5..e42efb8cb 100644 --- a/src/event/ngx_event_connect.c +++ b/src/event/ngx_event_connect.c @@ -203,16 +203,32 @@ ngx_log_debug(pc->log, "CONNECT: %s" _ peer->addr_port_text.data); } if (ngx_event_flags & NGX_USE_AIO_EVENT) { - /* aio, iocp */ - -#if 1 - /* TODO: NGX_EINPROGRESS */ + /* aio, iocp */ + + if (ngx_blocking(s) == -1) { + ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, + ngx_blocking_n " failed"); + + if (ngx_close_socket(s) == -1) { + ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, + ngx_close_socket_n " failed"); + } + + return NGX_ERROR; + } + + /* + * aio allows to post operation on non-connected socket + * at least in FreeBSD + * + * TODO: check in Win32, etc. + */ + rev->ready = 1; wev->ready = 1; return NGX_OK; -#endif } /* TODO: epoll */ diff --git a/src/os/unix/ngx_solaris_config.h b/src/os/unix/ngx_solaris_config.h index 43423aaa5..f94936dca 100644 --- a/src/os/unix/ngx_solaris_config.h +++ b/src/os/unix/ngx_solaris_config.h @@ -9,6 +9,7 @@ #define _FILE_OFFSET_BITS 64 /* must be before sys/types.h */ #include +#include #include /* offsetof */ #include #include