Mercurial > hg > nginx-quic
comparison src/stream/ngx_stream_core_module.c @ 6975:d7ce41bdf050
Stream: configurable socket buffer sizes.
The "rcvbuf" and "sndbuf" parameters are now supported by
the "listen" directive.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 03 Apr 2017 17:29:19 +0300 |
parents | cebf5fed00bf |
children | ed1101bbf19f |
comparison
equal
deleted
inserted
replaced
6974:289403abc84e | 6975:d7ce41bdf050 |
---|---|
580 static char * | 580 static char * |
581 ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 581 ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
582 { | 582 { |
583 ngx_stream_core_srv_conf_t *cscf = conf; | 583 ngx_stream_core_srv_conf_t *cscf = conf; |
584 | 584 |
585 ngx_str_t *value; | 585 ngx_str_t *value, size; |
586 ngx_url_t u; | 586 ngx_url_t u; |
587 ngx_uint_t i, backlog; | 587 ngx_uint_t i, backlog; |
588 ngx_stream_listen_t *ls, *als; | 588 ngx_stream_listen_t *ls, *als; |
589 ngx_stream_core_main_conf_t *cmcf; | 589 ngx_stream_core_main_conf_t *cmcf; |
590 | 590 |
618 | 618 |
619 ngx_memcpy(&ls->sockaddr.sockaddr, &u.sockaddr, u.socklen); | 619 ngx_memcpy(&ls->sockaddr.sockaddr, &u.sockaddr, u.socklen); |
620 | 620 |
621 ls->socklen = u.socklen; | 621 ls->socklen = u.socklen; |
622 ls->backlog = NGX_LISTEN_BACKLOG; | 622 ls->backlog = NGX_LISTEN_BACKLOG; |
623 ls->rcvbuf = -1; | |
624 ls->sndbuf = -1; | |
623 ls->type = SOCK_STREAM; | 625 ls->type = SOCK_STREAM; |
624 ls->wildcard = u.wildcard; | 626 ls->wildcard = u.wildcard; |
625 ls->ctx = cf->ctx; | 627 ls->ctx = cf->ctx; |
626 | 628 |
627 #if (NGX_HAVE_INET6) | 629 #if (NGX_HAVE_INET6) |
653 "invalid backlog \"%V\"", &value[i]); | 655 "invalid backlog \"%V\"", &value[i]); |
654 return NGX_CONF_ERROR; | 656 return NGX_CONF_ERROR; |
655 } | 657 } |
656 | 658 |
657 backlog = 1; | 659 backlog = 1; |
660 | |
661 continue; | |
662 } | |
663 | |
664 if (ngx_strncmp(value[i].data, "rcvbuf=", 7) == 0) { | |
665 size.len = value[i].len - 7; | |
666 size.data = value[i].data + 7; | |
667 | |
668 ls->rcvbuf = ngx_parse_size(&size); | |
669 ls->bind = 1; | |
670 | |
671 if (ls->rcvbuf == NGX_ERROR) { | |
672 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
673 "invalid rcvbuf \"%V\"", &value[i]); | |
674 return NGX_CONF_ERROR; | |
675 } | |
676 | |
677 continue; | |
678 } | |
679 | |
680 if (ngx_strncmp(value[i].data, "sndbuf=", 7) == 0) { | |
681 size.len = value[i].len - 7; | |
682 size.data = value[i].data + 7; | |
683 | |
684 ls->sndbuf = ngx_parse_size(&size); | |
685 ls->bind = 1; | |
686 | |
687 if (ls->sndbuf == NGX_ERROR) { | |
688 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
689 "invalid sndbuf \"%V\"", &value[i]); | |
690 return NGX_CONF_ERROR; | |
691 } | |
658 | 692 |
659 continue; | 693 continue; |
660 } | 694 } |
661 | 695 |
662 if (ngx_strncmp(value[i].data, "ipv6only=o", 10) == 0) { | 696 if (ngx_strncmp(value[i].data, "ipv6only=o", 10) == 0) { |