changeset 6173:1729d8d3eb3a

Mail: listen backlog=.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 08 Jun 2015 23:13:56 +0300
parents 3e8cddcff381
children 68c106e6fa0a
files src/mail/ngx_mail.c src/mail/ngx_mail.h src/mail/ngx_mail_core_module.c
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mail/ngx_mail.c
+++ b/src/mail/ngx_mail.c
@@ -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;
--- a/src/mail/ngx_mail.h
+++ b/src/mail/ngx_mail.h
@@ -58,6 +58,7 @@ typedef struct {
     int                     tcp_keepintvl;
     int                     tcp_keepcnt;
 #endif
+    int                     backlog;
 } ngx_mail_listen_t;
 
 
--- a/src/mail/ngx_mail_core_module.c
+++ b/src/mail/ngx_mail_core_module.c
@@ -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;