comparison src/stream/ngx_stream_core_module.c @ 8482:893b3313f53c quic

QUIC: added "quic" listen parameter in Stream. Also, introduced ngx_stream_quic_module.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 21 Jul 2020 23:08:39 +0300
parents 4f9b72a229c1
children 279ad36f2f4b
comparison
equal deleted inserted replaced
8481:0d2b2664b41c 8482:893b3313f53c
323 c->log->action = NULL; 323 c->log->action = NULL;
324 324
325 cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module); 325 cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module);
326 326
327 if (c->type == SOCK_STREAM 327 if (c->type == SOCK_STREAM
328 #if (NGX_STREAM_QUIC)
329 && c->qs == NULL
330 #endif
328 && cscf->tcp_nodelay 331 && cscf->tcp_nodelay
329 && ngx_tcp_nodelay(c) != NGX_OK) 332 && ngx_tcp_nodelay(c) != NGX_OK)
330 { 333 {
331 ngx_stream_finalize_session(s, NGX_STREAM_INTERNAL_SERVER_ERROR); 334 ngx_stream_finalize_session(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
332 return NGX_OK; 335 return NGX_OK;
739 "ngx_stream_ssl_module"); 742 "ngx_stream_ssl_module");
740 return NGX_CONF_ERROR; 743 return NGX_CONF_ERROR;
741 #endif 744 #endif
742 } 745 }
743 746
747 if (ngx_strcmp(value[i].data, "quic") == 0) {
748 #if (NGX_STREAM_QUIC)
749 ngx_stream_ssl_conf_t *sslcf;
750
751 sslcf = ngx_stream_conf_get_module_srv_conf(cf,
752 ngx_stream_ssl_module);
753
754 sslcf->listen = 1;
755 sslcf->file = cf->conf_file->file.name.data;
756 sslcf->line = cf->conf_file->line;
757
758 ls->quic = 1;
759 ls->type = SOCK_DGRAM;
760
761 continue;
762 #else
763 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
764 "the \"quic\" parameter requires "
765 "ngx_stream_quic_module");
766 return NGX_CONF_ERROR;
767 #endif
768 }
769
744 if (ngx_strncmp(value[i].data, "so_keepalive=", 13) == 0) { 770 if (ngx_strncmp(value[i].data, "so_keepalive=", 13) == 0) {
745 771
746 if (ngx_strcmp(&value[i].data[13], "on") == 0) { 772 if (ngx_strcmp(&value[i].data[13], "on") == 0) {
747 ls->so_keepalive = 1; 773 ls->so_keepalive = 1;
748 774
847 } 873 }
848 874
849 #if (NGX_STREAM_SSL) 875 #if (NGX_STREAM_SSL)
850 if (ls->ssl) { 876 if (ls->ssl) {
851 return "\"ssl\" parameter is incompatible with \"udp\""; 877 return "\"ssl\" parameter is incompatible with \"udp\"";
878 }
879 #endif
880
881 #if (NGX_STREAM_SSL && NGX_STREAM_QUIC)
882 if (ls->ssl && ls->quic) {
883 return "\"ssl\" parameter is incompatible with \"quic\"";
852 } 884 }
853 #endif 885 #endif
854 886
855 if (ls->so_keepalive) { 887 if (ls->so_keepalive) {
856 return "\"so_keepalive\" parameter is incompatible with \"udp\""; 888 return "\"so_keepalive\" parameter is incompatible with \"udp\"";