QUIC: allowed main QUIC connection for some operations.
Operations like ngx_quic_open_stream(), ngx_http_quic_get_connection(), ngx_http_v3_finalize_connection(), ngx_http_v3_shutdown_connection() used to receive a QUIC stream connection. Now they can receive the main QUIC connection as well. This is useful when calling them from a stream context.
This commit is contained in:
parent
1d39bb83db
commit
d503544196
|
@ -40,11 +40,12 @@ ngx_connection_t *
|
|||
ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi)
|
||||
{
|
||||
uint64_t id;
|
||||
ngx_quic_stream_t *qs, *nqs;
|
||||
ngx_connection_t *pc;
|
||||
ngx_quic_stream_t *nqs;
|
||||
ngx_quic_connection_t *qc;
|
||||
|
||||
qs = c->quic;
|
||||
qc = ngx_quic_get_connection(qs->parent);
|
||||
pc = c->quic ? c->quic->parent : c;
|
||||
qc = ngx_quic_get_connection(pc);
|
||||
|
||||
if (bidi) {
|
||||
if (qc->streams.server_streams_bidi
|
||||
|
@ -90,7 +91,7 @@ ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi)
|
|||
qc->streams.server_streams_uni++;
|
||||
}
|
||||
|
||||
nqs = ngx_quic_create_stream(qs->parent, id);
|
||||
nqs = ngx_quic_create_stream(pc, id);
|
||||
if (nqs == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ ngx_http_v3_keepalive_handler(ngx_event_t *ev)
|
|||
|
||||
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 keepalive handler");
|
||||
|
||||
ngx_quic_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR,
|
||||
"keepalive timeout");
|
||||
ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR,
|
||||
"keepalive timeout");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@
|
|||
|
||||
|
||||
#define ngx_http_quic_get_connection(c) \
|
||||
((ngx_http_connection_t *) (c)->quic->parent->data)
|
||||
((ngx_http_connection_t *) ((c)->quic ? (c)->quic->parent->data \
|
||||
: (c)->data))
|
||||
|
||||
#define ngx_http_v3_get_session(c) ngx_http_quic_get_connection(c)->v3_session
|
||||
|
||||
|
@ -91,10 +92,12 @@
|
|||
module)
|
||||
|
||||
#define ngx_http_v3_finalize_connection(c, code, reason) \
|
||||
ngx_quic_finalize_connection(c->quic->parent, code, reason)
|
||||
ngx_quic_finalize_connection((c)->quic ? (c)->quic->parent : (c), \
|
||||
code, reason)
|
||||
|
||||
#define ngx_http_v3_shutdown_connection(c, code, reason) \
|
||||
ngx_quic_shutdown_connection(c->quic->parent, code, reason)
|
||||
ngx_quic_shutdown_connection((c)->quic ? (c)->quic->parent : (c), \
|
||||
code, reason)
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue