[nginx] Mail: listen backlog=.

Ruslan Ermilov ru at nginx.com
Mon Jun 8 20:30:09 UTC 2015


details:   http://hg.nginx.org/nginx/rev/1729d8d3eb3a
branches:  
changeset: 6173:1729d8d3eb3a
user:      Ruslan Ermilov <ru at nginx.com>
date:      Mon Jun 08 23:13:56 2015 +0300
description:
Mail: listen backlog=.

diffstat:

 src/mail/ngx_mail.c             |   2 ++
 src/mail/ngx_mail.h             |   1 +
 src/mail/ngx_mail_core_module.c |  14 ++++++++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)

diffs (54 lines):

diff -r 3e8cddcff381 -r 1729d8d3eb3a src/mail/ngx_mail.c
--- a/src/mail/ngx_mail.c	Mon Jun 08 23:13:33 2015 +0300
+++ b/src/mail/ngx_mail.c	Mon Jun 08 23:13:56 2015 +0300
@@ -359,6 +359,8 @@ ngx_mail_optimize_servers(ngx_conf_t *cf
             ls->log.data = &ls->addr_text;
             ls->log.handler = ngx_accept_log_error;
 
+            ls->backlog = addr[i].opt.backlog;
+
             ls->keepalive = addr[i].opt.so_keepalive;
 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
             ls->keepidle = addr[i].opt.tcp_keepidle;
diff -r 3e8cddcff381 -r 1729d8d3eb3a src/mail/ngx_mail.h
--- a/src/mail/ngx_mail.h	Mon Jun 08 23:13:33 2015 +0300
+++ b/src/mail/ngx_mail.h	Mon Jun 08 23:13:56 2015 +0300
@@ -58,6 +58,7 @@ typedef struct {
     int                     tcp_keepintvl;
     int                     tcp_keepcnt;
 #endif
+    int                     backlog;
 } ngx_mail_listen_t;
 
 
diff -r 3e8cddcff381 -r 1729d8d3eb3a src/mail/ngx_mail_core_module.c
--- a/src/mail/ngx_mail_core_module.c	Mon Jun 08 23:13:33 2015 +0300
+++ b/src/mail/ngx_mail_core_module.c	Mon Jun 08 23:13:56 2015 +0300
@@ -383,6 +383,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx
     ngx_memcpy(&ls->u.sockaddr, u.sockaddr, u.socklen);
 
     ls->socklen = u.socklen;
+    ls->backlog = NGX_LISTEN_BACKLOG;
     ls->wildcard = u.wildcard;
     ls->ctx = cf->ctx;
 
@@ -418,6 +419,19 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx
             continue;
         }
 
+        if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) {
+            ls->backlog = ngx_atoi(value[i].data + 8, value[i].len - 8);
+            ls->bind = 1;
+
+            if (ls->backlog == NGX_ERROR || ls->backlog == 0) {
+                ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                                   "invalid backlog \"%V\"", &value[i]);
+                return NGX_CONF_ERROR;
+            }
+
+            continue;
+        }
+
         if (ngx_strncmp(value[i].data, "ipv6only=o", 10) == 0) {
 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
             struct sockaddr  *sa;



More information about the nginx-devel mailing list