summaryrefslogtreecommitdiffhomepage
path: root/src/event
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2020-10-01 10:04:35 +0300
committerVladimir Homutov <vl@nginx.com>2020-10-01 10:04:35 +0300
commit0f843cfb74dd4dab7bff4d9a0f7e73b8b8cb61f0 (patch)
tree83f084a7d73a8dc5fc7183d7946fb548f405aeb5 /src/event
parentf797a8a5b5a2012b0cae9745f05386b628365cb7 (diff)
downloadnginx-0f843cfb74dd4dab7bff4d9a0f7e73b8b8cb61f0.tar.gz
nginx-0f843cfb74dd4dab7bff4d9a0f7e73b8b8cb61f0.tar.bz2
QUIC: moved ssl configuration pointer to quic configuration.
The ssl configuration is obtained at config time and saved for future use.
Diffstat (limited to 'src/event')
-rw-r--r--src/event/ngx_event_quic.c32
-rw-r--r--src/event/ngx_event_quic.h3
2 files changed, 16 insertions, 19 deletions
diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c
index 5b99e99b1..a9c092176 100644
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -120,8 +120,6 @@ struct ngx_quic_connection_s {
ngx_quic_conf_t *conf;
- ngx_ssl_t *ssl;
-
ngx_event_t push;
ngx_event_t pto;
ngx_event_t close;
@@ -193,7 +191,7 @@ static int ngx_quic_send_alert(ngx_ssl_conn_t *ssl_conn,
static ngx_quic_connection_t *ngx_quic_new_connection(ngx_connection_t *c,
- ngx_ssl_t *ssl, ngx_quic_conf_t *conf, ngx_quic_header_t *pkt);
+ ngx_quic_conf_t *conf, ngx_quic_header_t *pkt);
static ngx_int_t ngx_quic_send_stateless_reset(ngx_connection_t *c,
ngx_quic_conf_t *conf, ngx_quic_header_t *pkt);
static ngx_int_t ngx_quic_process_stateless_reset(ngx_connection_t *c,
@@ -217,8 +215,8 @@ static ngx_int_t ngx_quic_close_streams(ngx_connection_t *c,
ngx_quic_connection_t *qc);
static ngx_int_t ngx_quic_input(ngx_connection_t *c, ngx_buf_t *b,
- ngx_ssl_t *ssl, ngx_quic_conf_t *conf);
-static ngx_int_t ngx_quic_process_packet(ngx_connection_t *c, ngx_ssl_t *ssl,
+ ngx_quic_conf_t *conf);
+static ngx_int_t ngx_quic_process_packet(ngx_connection_t *c,
ngx_quic_conf_t *conf, ngx_quic_header_t *pkt);
static ngx_int_t ngx_quic_init_secrets(ngx_connection_t *c);
static void ngx_quic_discard_ctx(ngx_connection_t *c,
@@ -639,7 +637,7 @@ ngx_quic_send_alert(ngx_ssl_conn_t *ssl_conn, enum ssl_encryption_level_t level,
void
-ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_conf_t *conf)
+ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf)
{
ngx_int_t rc;
@@ -647,7 +645,7 @@ ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_conf_t *conf)
c->log->action = "QUIC initialization";
- rc = ngx_quic_input(c, c->buffer, ssl, conf);
+ rc = ngx_quic_input(c, c->buffer, conf);
if (rc != NGX_OK) {
ngx_quic_close_connection(c, rc == NGX_DECLINED ? NGX_DONE : NGX_ERROR);
return;
@@ -663,8 +661,8 @@ ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_conf_t *conf)
static ngx_quic_connection_t *
-ngx_quic_new_connection(ngx_connection_t *c, ngx_ssl_t *ssl,
- ngx_quic_conf_t *conf, ngx_quic_header_t *pkt)
+ngx_quic_new_connection(ngx_connection_t *c, ngx_quic_conf_t *conf,
+ ngx_quic_header_t *pkt)
{
ngx_uint_t i;
ngx_quic_tp_t *ctp;
@@ -718,7 +716,6 @@ ngx_quic_new_connection(ngx_connection_t *c, ngx_ssl_t *ssl,
qc->push.handler = ngx_quic_push_handler;
qc->push.cancelable = 1;
- qc->ssl = ssl;
qc->conf = conf;
qc->tp = conf->tp;
@@ -1211,7 +1208,7 @@ ngx_quic_init_connection(ngx_connection_t *c)
qc = c->quic;
- if (ngx_ssl_create_connection(qc->ssl, c, NGX_SSL_BUFFER) != NGX_OK) {
+ if (ngx_ssl_create_connection(qc->conf->ssl, c, NGX_SSL_BUFFER) != NGX_OK) {
return NGX_ERROR;
}
@@ -1345,7 +1342,7 @@ ngx_quic_input_handler(ngx_event_t *rev)
b.last += n;
qc->received += n;
- rc = ngx_quic_input(c, &b, NULL, NULL);
+ rc = ngx_quic_input(c, &b, NULL);
if (rc == NGX_ERROR) {
ngx_quic_close_connection(c, NGX_ERROR);
@@ -1609,8 +1606,7 @@ ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc)
static ngx_int_t
-ngx_quic_input(ngx_connection_t *c, ngx_buf_t *b, ngx_ssl_t *ssl,
- ngx_quic_conf_t *conf)
+ngx_quic_input(ngx_connection_t *c, ngx_buf_t *b, ngx_quic_conf_t *conf)
{
u_char *p;
ngx_int_t rc;
@@ -1632,7 +1628,7 @@ ngx_quic_input(ngx_connection_t *c, ngx_buf_t *b, ngx_ssl_t *ssl,
pkt.flags = p[0];
pkt.raw->pos++;
- rc = ngx_quic_process_packet(c, ssl, conf, &pkt);
+ rc = ngx_quic_process_packet(c, conf, &pkt);
if (rc == NGX_ERROR) {
return NGX_ERROR;
@@ -1677,8 +1673,8 @@ ngx_quic_input(ngx_connection_t *c, ngx_buf_t *b, ngx_ssl_t *ssl,
static ngx_int_t
-ngx_quic_process_packet(ngx_connection_t *c, ngx_ssl_t *ssl,
- ngx_quic_conf_t *conf, ngx_quic_header_t *pkt)
+ngx_quic_process_packet(ngx_connection_t *c, ngx_quic_conf_t *conf,
+ ngx_quic_header_t *pkt)
{
ngx_int_t rc;
ngx_ssl_conn_t *ssl_conn;
@@ -1771,7 +1767,7 @@ ngx_quic_process_packet(ngx_connection_t *c, ngx_ssl_t *ssl,
return NGX_ERROR;
}
- qc = ngx_quic_new_connection(c, ssl, conf, pkt);
+ qc = ngx_quic_new_connection(c, conf, pkt);
if (qc == NULL) {
return NGX_ERROR;
}
diff --git a/src/event/ngx_event_quic.h b/src/event/ngx_event_quic.h
index 1249a8b9e..2dac905e7 100644
--- a/src/event/ngx_event_quic.h
+++ b/src/event/ngx_event_quic.h
@@ -86,6 +86,7 @@ typedef struct {
typedef struct {
+ ngx_ssl_t *ssl;
ngx_quic_tp_t tp;
ngx_flag_t retry;
ngx_flag_t require_alpn;
@@ -114,7 +115,7 @@ struct ngx_quic_stream_s {
};
-void ngx_quic_run(ngx_connection_t *c, ngx_ssl_t *ssl, ngx_quic_conf_t *conf);
+void ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf);
ngx_connection_t *ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi);
void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err,
const char *reason);