diff src/core/ngx_connection.c @ 5550:3c5ddf0575d8

Core: handle getsockopt(TCP_FASTOPEN) failures. Linux returns EOPNOTSUPP for non-TCP sockets and ENOPROTOOPT for TCP sockets, because getsockopt(TCP_FASTOPEN) is not implemented so far. While there, lower the log level from ALERT to NOTICE to match other getsockopt() failures. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
author Piotr Sikora <piotr@cloudflare.com>
date Thu, 30 Jan 2014 14:58:21 -0800
parents fdb67cfc957d
children 188481078faf
line wrap: on
line diff
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -97,7 +97,7 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
     ngx_uint_t                 i;
     ngx_listening_t           *ls;
     socklen_t                  olen;
-#if (NGX_HAVE_DEFERRED_ACCEPT)
+#if (NGX_HAVE_DEFERRED_ACCEPT || NGX_HAVE_TCP_FASTOPEN)
     ngx_err_t                  err;
 #endif
 #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
@@ -223,9 +223,13 @@ ngx_set_inherited_sockets(ngx_cycle_t *c
                        (void *) &ls[i].fastopen, &olen)
             == -1)
         {
-            ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
-                          "getsockopt(TCP_FASTOPEN) %V failed, ignored",
-                          &ls[i].addr_text);
+            err = ngx_socket_errno;
+
+            if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT) {
+                ngx_log_error(NGX_LOG_NOTICE, cycle->log, err,
+                              "getsockopt(TCP_FASTOPEN) %V failed, ignored",
+                              &ls[i].addr_text);
+            }
 
             ls[i].fastopen = -1;
         }