Skip to content

Commit

Permalink
Mail: listen backlog=.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdocguard committed Jun 8, 2015
1 parent 60c654d commit c81d7ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mail/ngx_mail.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
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;
Expand Down
1 change: 1 addition & 0 deletions src/mail/ngx_mail.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct {
int tcp_keepintvl;
int tcp_keepcnt;
#endif
int backlog;
} ngx_mail_listen_t;


Expand Down
14 changes: 14 additions & 0 deletions src/mail/ngx_mail_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
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;

Expand Down Expand Up @@ -418,6 +419,19 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
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;
Expand Down

0 comments on commit c81d7ec

Please sign in to comment.