Klaus Demo nginx / a965e1d
Mail: configurable socket buffer sizes. The "rcvbuf" and "sndbuf" parameters are now supported by the "listen" directive. Vladimir Homutov 5 years ago
3 changed file(s) with 39 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
332332 ls->log.handler = ngx_accept_log_error;
333333
334334 ls->backlog = addr[i].opt.backlog;
335 ls->rcvbuf = addr[i].opt.rcvbuf;
336 ls->sndbuf = addr[i].opt.sndbuf;
335337
336338 ls->keepalive = addr[i].opt.so_keepalive;
337339 #if (NGX_HAVE_KEEPALIVE_TUNABLE)
4545 int tcp_keepcnt;
4646 #endif
4747 int backlog;
48 int rcvbuf;
49 int sndbuf;
4850 } ngx_mail_listen_t;
4951
5052
294294 {
295295 ngx_mail_core_srv_conf_t *cscf = conf;
296296
297 ngx_str_t *value;
297 ngx_str_t *value, size;
298298 ngx_url_t u;
299299 ngx_uint_t i, m;
300300 ngx_mail_listen_t *ls;
349349
350350 ls->socklen = u.socklen;
351351 ls->backlog = NGX_LISTEN_BACKLOG;
352 ls->rcvbuf = -1;
353 ls->sndbuf = -1;
352354 ls->wildcard = u.wildcard;
353355 ls->ctx = cf->ctx;
354356
391393 if (ls->backlog == NGX_ERROR || ls->backlog == 0) {
392394 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
393395 "invalid backlog \"%V\"", &value[i]);
396 return NGX_CONF_ERROR;
397 }
398
399 continue;
400 }
401
402 if (ngx_strncmp(value[i].data, "rcvbuf=", 7) == 0) {
403 size.len = value[i].len - 7;
404 size.data = value[i].data + 7;
405
406 ls->rcvbuf = ngx_parse_size(&size);
407 ls->bind = 1;
408
409 if (ls->rcvbuf == NGX_ERROR) {
410 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
411 "invalid rcvbuf \"%V\"", &value[i]);
412 return NGX_CONF_ERROR;
413 }
414
415 continue;
416 }
417
418 if (ngx_strncmp(value[i].data, "sndbuf=", 7) == 0) {
419 size.len = value[i].len - 7;
420 size.data = value[i].data + 7;
421
422 ls->sndbuf = ngx_parse_size(&size);
423 ls->bind = 1;
424
425 if (ls->sndbuf == NGX_ERROR) {
426 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
427 "invalid sndbuf \"%V\"", &value[i]);
394428 return NGX_CONF_ERROR;
395429 }
396430