]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.0.1-2003-10-30-19:51:33 import
authorIgor Sysoev <igor@sysoev.ru>
Thu, 30 Oct 2003 16:51:33 +0000 (16:51 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 30 Oct 2003 16:51:33 +0000 (16:51 +0000)
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

index 5818636a8c3682329c302061221f0b2fd7d7ef62..60d68a06c81ee9bdd338d9199161822a3cb1de2f 100644 (file)
@@ -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";
     }
 
index 3799cef78b429d9d36a7c2c5828f01cff6717bab..de57a5d025363ffaace14fe8742676de5896ce4f 100644 (file)
@@ -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;
         }
 
index 3de78aa200844212c2a38f23d31f40c15ee6a087..e68ba6d226e0dcd7f3aa3c42411a43997158cf04 100644 (file)
@@ -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);
index b50cf9074c35ffbd2ffbce0d2e10351fbef5bd90..69ed5bc551c35450cb6fb003f92c30c943414c8f 100644 (file)
@@ -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;
 
     /*
index c21abde0df6c317990e8373ee34c0b94e6977211..d652ac29787d40d80b23fcf425f52929826dc2be 100644 (file)
@@ -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;
 
index c697c1be5183d4df883937fbd8bf8d70f25cf9d8..e42efb8cb27e2ae113f4804e368e545680beb852 100644 (file)
@@ -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 */
 
+        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 */
index 43423aaa5c3510568de0fc557bc12ee2f5349a21..f94936dca9980a78d3b0e441ab8610aecc139fd7 100644 (file)
@@ -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>