Mercurial > hg > nginx
comparison src/stream/ngx_stream_core_module.c @ 7846:2ab7b55ae4a0
Stream: the "fastopen" parameter of the "listen" directive.
Based on a patch by Anbang Wen.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 20 May 2021 19:59:16 +0300 |
parents | 4f9b72a229c1 |
children | 4cc2bfeff46c d514f88053e5 |
comparison
equal
deleted
inserted
replaced
7845:5772da03faf8 | 7846:2ab7b55ae4a0 |
---|---|
613 ls->rcvbuf = -1; | 613 ls->rcvbuf = -1; |
614 ls->sndbuf = -1; | 614 ls->sndbuf = -1; |
615 ls->type = SOCK_STREAM; | 615 ls->type = SOCK_STREAM; |
616 ls->ctx = cf->ctx; | 616 ls->ctx = cf->ctx; |
617 | 617 |
618 #if (NGX_HAVE_TCP_FASTOPEN) | |
619 ls->fastopen = -1; | |
620 #endif | |
621 | |
618 #if (NGX_HAVE_INET6) | 622 #if (NGX_HAVE_INET6) |
619 ls->ipv6only = 1; | 623 ls->ipv6only = 1; |
620 #endif | 624 #endif |
621 | 625 |
622 backlog = 0; | 626 backlog = 0; |
632 | 636 |
633 if (ngx_strcmp(value[i].data, "bind") == 0) { | 637 if (ngx_strcmp(value[i].data, "bind") == 0) { |
634 ls->bind = 1; | 638 ls->bind = 1; |
635 continue; | 639 continue; |
636 } | 640 } |
641 | |
642 #if (NGX_HAVE_TCP_FASTOPEN) | |
643 if (ngx_strncmp(value[i].data, "fastopen=", 9) == 0) { | |
644 ls->fastopen = ngx_atoi(value[i].data + 9, value[i].len - 9); | |
645 ls->bind = 1; | |
646 | |
647 if (ls->fastopen == NGX_ERROR) { | |
648 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
649 "invalid fastopen \"%V\"", &value[i]); | |
650 return NGX_CONF_ERROR; | |
651 } | |
652 | |
653 continue; | |
654 } | |
655 #endif | |
637 | 656 |
638 if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) { | 657 if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) { |
639 ls->backlog = ngx_atoi(value[i].data + 8, value[i].len - 8); | 658 ls->backlog = ngx_atoi(value[i].data + 8, value[i].len - 8); |
640 ls->bind = 1; | 659 ls->bind = 1; |
641 | 660 |
857 } | 876 } |
858 | 877 |
859 if (ls->proxy_protocol) { | 878 if (ls->proxy_protocol) { |
860 return "\"proxy_protocol\" parameter is incompatible with \"udp\""; | 879 return "\"proxy_protocol\" parameter is incompatible with \"udp\""; |
861 } | 880 } |
881 | |
882 #if (NGX_HAVE_TCP_FASTOPEN) | |
883 if (ls->fastopen != -1) { | |
884 return "\"fastopen\" parameter is incompatible with \"udp\""; | |
885 } | |
886 #endif | |
862 } | 887 } |
863 | 888 |
864 als = cmcf->listen.elts; | 889 als = cmcf->listen.elts; |
865 | 890 |
866 for (n = 0; n < u.naddrs; n++) { | 891 for (n = 0; n < u.naddrs; n++) { |