diff src/event/ngx_event_connect.c @ 487:31ff3e943e16 release-0.1.18

nginx-0.1.18-RELEASE import *) Workaround: the default values of the devpoll_events and the devpoll_changes directives changed from 512 to 32 to be compatible with Solaris 10. *) Bugfix: the proxy_set_x_var and fastcgi_set_var directives were not inherited. *) Bugfix: in the redirect rewrite directive the arguments were concatenated with URI by the "&" rather than the "?". *) Bugfix: the lines without trailing ";" in the file being included by the ngx_http_geo_module were silently ignored. *) Feature: the ngx_http_stub_status_module. *) Bugfix: the unknown log format in the access_log directive caused the segmentation fault. *) Feature: the new "document_root" parameter of the fastcgi_params directive. *) Feature: the fastcgi_redirect_errors directive. *) Feature: the new "break" modifier of the "rewrite" directive allows to stop the rewrite/location cycle and sets the current configuration to the request.
author Igor Sysoev <igor@sysoev.ru>
date Wed, 09 Feb 2005 14:31:07 +0000
parents 621229427cba
children 9b8c906f6e63
line wrap: on
line diff
--- a/src/event/ngx_event_connect.c
+++ b/src/event/ngx_event_connect.c
@@ -10,7 +10,11 @@
 #include <ngx_event_connect.h>
 
 
-ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc)
+#define NGX_RESOLVER_BUFSIZE  8192
+
+
+ngx_int_t
+ngx_event_connect_peer(ngx_peer_connection_t *pc)
 {
     int                  rc;
     ngx_uint_t           instance;
@@ -274,12 +278,18 @@ ngx_int_t ngx_event_connect_peer(ngx_pee
         if (err != NGX_EINPROGRESS && err != NGX_EAGAIN) {
             ngx_connection_error(c, err, "connect() failed");
 
-            if (ngx_close_socket(s) == -1) {
-                ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno,
-                              ngx_close_socket_n " failed");
+#if 0
+#undef sun
+            {
+            struct sockaddr_un  *sun;
+
+            sun = (struct sockaddr_un *) peer->sockaddr;
+
+            ngx_log_error(NGX_LOG_ALERT, pc->log, 0,
+                          "\"%s\", f:%d, l:%uz",
+                          sun->sun_path, sun->sun_family, peer->socklen);
             }
-
-            c->fd = (ngx_socket_t) -1;
+#endif
 
             return NGX_CONNECT_ERROR;
         }
@@ -287,7 +297,9 @@ ngx_int_t ngx_event_connect_peer(ngx_pee
 
     if (ngx_add_conn) {
         if (rc == -1) {
+
             /* NGX_EINPROGRESS */
+
             return NGX_AGAIN;
         }
  
@@ -308,17 +320,11 @@ ngx_int_t ngx_event_connect_peer(ngx_pee
         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;
         }
 
         /*
-         * FreeBSD aio allows to post operation on non-connected socket.
+         * FreeBSD's aio allows to post an operation on non-connected socket.
          * NT does not support it.
          * 
          * TODO: check in Win32, etc. As workaround we can use NGX_ONESHOT_EVENT
@@ -330,10 +336,16 @@ ngx_int_t ngx_event_connect_peer(ngx_pee
         return NGX_OK;
     }
 
-    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {     /* kqueue */
+    if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
+
+        /* kqueue */
+
         event = NGX_CLEAR_EVENT;
 
-    } else {                                  /* select, poll, /dev/poll */
+    } else {
+
+        /* select, poll, /dev/poll */
+
         event = NGX_LEVEL_EVENT;
     }
 
@@ -360,7 +372,8 @@ ngx_int_t ngx_event_connect_peer(ngx_pee
 }
 
 
-void ngx_event_connect_peer_failed(ngx_peer_connection_t *pc)
+void
+ngx_event_connect_peer_failed(ngx_peer_connection_t *pc)
 {
     time_t  now;
 
@@ -380,6 +393,4 @@ void ngx_event_connect_peer_failed(ngx_p
     }
 
     pc->tries--;
-
-    return;
 }