changeset 167:8aef3c72e5da

nginx-0.0.1-2003-10-30-19:51:33 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 30 Oct 2003 16:51:33 +0000
parents 389d7ee9fa60
children ba5dbb949603
files src/core/ngx_conf_file.c src/core/ngx_hunk.c src/core/ngx_hunk.h src/core/ngx_output_chain.c src/event/modules/ngx_devpoll_module.c src/event/ngx_event_connect.c src/os/unix/ngx_solaris_config.h
diffstat 7 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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 
     }
 
     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";
     }
 
--- a/src/core/ngx_hunk.c
+++ b/src/core/ngx_hunk.c
@@ -115,7 +115,7 @@ void ngx_chain_update_chains(ngx_chain_t
     *out = NULL;
 
     while (*busy) {
-        if (ngx_hunk_size((*busy)->hunk) > 0) {
+        if (ngx_hunk_size((*busy)->hunk) != 0) {
             break;
         }
 
--- 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);
--- 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(ng
 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;
 
     /*
--- 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(ng
 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;
 
--- 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" _ p
     }
 
     if (ngx_event_flags & NGX_USE_AIO_EVENT) {
+
         /* 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.
+         */
  
-#if 1
-        /* TODO: NGX_EINPROGRESS */
-
         rev->ready = 1;
         wev->ready = 1;
 
         return NGX_OK;
-#endif
     }
 
     /* TODO: epoll */
--- 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 <unistd.h>
+#include <inttypes.h>
 #include <stddef.h>             /* offsetof */
 #include <stdlib.h>
 #include <stdarg.h>