Documentation doesn't match code

sridhar basam sridhar.basam at gmail.com
Mon Mar 1 22:18:58 MSK 2010


The documentation for the mail proxy module state the "so_keepalive"
variable can be used to toggle keepalive functionality to the backend
server.

The actual code though uses this configuration variable to drive keepalive
functionality on the client side connection though. Below is a short patch
which changes the keepalive functionality to the backend server.

--- ngx_mail_proxy_module.c.orig        2009-11-02 10:14:17.000000000 -0500
+++ ngx_mail_proxy_module.c     2010-03-01 14:09:20.866649958 -0500
@@ -120,18 +120,6 @@

     cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);

-    if (cscf->so_keepalive) {
-        keepalive = 1;
-
-        if (setsockopt(s->connection->fd, SOL_SOCKET, SO_KEEPALIVE,
-                       (const void *) &keepalive, sizeof(int))
-                == -1)
-        {
-            ngx_log_error(NGX_LOG_ALERT, s->connection->log,
ngx_socket_errno,
-                          "setsockopt(SO_KEEPALIVE) failed");
-        }
-    }
-
     p = ngx_pcalloc(s->connection->pool, sizeof(ngx_mail_proxy_ctx_t));
     if (p == NULL) {
         ngx_mail_session_internal_server_error(s);
@@ -154,6 +142,18 @@
         return;
     }

+    if (cscf->so_keepalive) {
+        keepalive = 1;
+
+        if (setsockopt(s->proxy->upstream.connection->fd, SOL_SOCKET,
SO_KEEPALIVE,
+                       (const void *) &keepalive, sizeof(int))
+                == -1)
+        {
+            ngx_log_error(NGX_LOG_ALERT, s->connection->log,
ngx_socket_errno,
+                          "setsockopt(SO_KEEPALIVE) failed");
+        }
+    }
+
     ngx_add_timer(p->upstream.connection->read, cscf->timeout);

     p->upstream.connection->data = s;


-- 
Sridhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100301/956d8354/attachment.html>


More information about the nginx mailing list