Documentation doesn't match code

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;

Hello!

On Mon, Mar 01, 2010 at 02:18:58PM -0500, sridhar basam wrote:

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

Wow. Where did you find one? May be you mean wiki?

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.

It is believed that it works as expected - sets SO_KEEPALIVE on
client socket once we are about to open backend connection (which
is usually resource consuming, as backends are used to follow
process per connection model). This allows to free backend
connections early as long as clients silently disappear.

You may want to fix wiki instead (it seems to be down right now
though).

Maxim D.

On Mon, Mar 1, 2010 at 2:43 PM, Maxim D. [email protected] wrote:

That is right, it was on the english wiki. I have corrected it on the
wiki,
if you want to give it a look.

connections early as long as clients silently disappear.

You may want to fix wiki instead (it seems to be down right now
though).

Yeah, guess doing it on either end is fine, since the backend is going
to
get torn down if the client is detected as down.

sridhar

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs