comparison src/http/v3/ngx_http_v3_streams.c @ 8770:67f0eb150047 quic

HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 05 May 2021 12:54:10 +0300
parents 9ec3e71f8a61
children 0981329169ea
comparison
equal deleted inserted replaced
8769:9ec3e71f8a61 8770:67f0eb150047
45 ngx_http_v3_init_session(ngx_connection_t *c) 45 ngx_http_v3_init_session(ngx_connection_t *c)
46 { 46 {
47 ngx_connection_t *pc; 47 ngx_connection_t *pc;
48 ngx_pool_cleanup_t *cln; 48 ngx_pool_cleanup_t *cln;
49 ngx_http_connection_t *hc; 49 ngx_http_connection_t *hc;
50 ngx_http_v3_connection_t *h3c; 50 ngx_http_v3_session_t *h3c;
51 51
52 pc = c->quic->parent; 52 pc = c->quic->parent;
53 hc = pc->data; 53 hc = pc->data;
54 54
55 if (hc->v3_session) { 55 if (hc->v3_session) {
56 return NGX_OK; 56 return NGX_OK;
57 } 57 }
58 58
59 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init session"); 59 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init session");
60 60
61 h3c = ngx_pcalloc(pc->pool, sizeof(ngx_http_v3_connection_t)); 61 h3c = ngx_pcalloc(pc->pool, sizeof(ngx_http_v3_session_t));
62 if (h3c == NULL) { 62 if (h3c == NULL) {
63 return NGX_ERROR; 63 return NGX_ERROR;
64 } 64 }
65 65
66 h3c->max_push_id = (uint64_t) -1; 66 h3c->max_push_id = (uint64_t) -1;
102 102
103 103
104 static void 104 static void
105 ngx_http_v3_cleanup_session(void *data) 105 ngx_http_v3_cleanup_session(void *data)
106 { 106 {
107 ngx_http_v3_connection_t *h3c = data; 107 ngx_http_v3_session_t *h3c = data;
108 108
109 if (h3c->keepalive.timer_set) { 109 if (h3c->keepalive.timer_set) {
110 ngx_del_timer(&h3c->keepalive); 110 ngx_del_timer(&h3c->keepalive);
111 } 111 }
112 } 112 }
140 140
141 static void 141 static void
142 ngx_http_v3_close_uni_stream(ngx_connection_t *c) 142 ngx_http_v3_close_uni_stream(ngx_connection_t *c)
143 { 143 {
144 ngx_pool_t *pool; 144 ngx_pool_t *pool;
145 ngx_http_v3_connection_t *h3c; 145 ngx_http_v3_session_t *h3c;
146 ngx_http_v3_uni_stream_t *us; 146 ngx_http_v3_uni_stream_t *us;
147 147
148 us = c->data; 148 us = c->data;
149 h3c = ngx_http_v3_get_session(c); 149 h3c = ngx_http_v3_get_session(c);
150 150
169 { 169 {
170 u_char ch; 170 u_char ch;
171 ssize_t n; 171 ssize_t n;
172 ngx_int_t index, rc; 172 ngx_int_t index, rc;
173 ngx_connection_t *c; 173 ngx_connection_t *c;
174 ngx_http_v3_connection_t *h3c; 174 ngx_http_v3_session_t *h3c;
175 ngx_http_v3_uni_stream_t *us; 175 ngx_http_v3_uni_stream_t *us;
176 176
177 c = rev->data; 177 c = rev->data;
178 us = c->data; 178 us = c->data;
179 h3c = ngx_http_v3_get_session(c); 179 h3c = ngx_http_v3_get_session(c);
377 /* XXX async & buffered stream writes */ 377 /* XXX async & buffered stream writes */
378 378
379 ngx_connection_t * 379 ngx_connection_t *
380 ngx_http_v3_create_push_stream(ngx_connection_t *c, uint64_t push_id) 380 ngx_http_v3_create_push_stream(ngx_connection_t *c, uint64_t push_id)
381 { 381 {
382 u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 2]; 382 u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 2];
383 size_t n; 383 size_t n;
384 ngx_connection_t *sc; 384 ngx_connection_t *sc;
385 ngx_pool_cleanup_t *cln; 385 ngx_pool_cleanup_t *cln;
386 ngx_http_v3_push_t *push; 386 ngx_http_v3_push_t *push;
387 ngx_http_v3_connection_t *h3c; 387 ngx_http_v3_session_t *h3c;
388 388
389 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 389 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
390 "http3 create push stream id:%uL", push_id); 390 "http3 create push stream id:%uL", push_id);
391 391
392 sc = ngx_quic_open_stream(c, 0); 392 sc = ngx_quic_open_stream(c, 0);
445 { 445 {
446 u_char buf[NGX_HTTP_V3_VARLEN_INT_LEN]; 446 u_char buf[NGX_HTTP_V3_VARLEN_INT_LEN];
447 size_t n; 447 size_t n;
448 ngx_int_t index; 448 ngx_int_t index;
449 ngx_connection_t *sc; 449 ngx_connection_t *sc;
450 ngx_http_v3_connection_t *h3c; 450 ngx_http_v3_session_t *h3c;
451 ngx_http_v3_uni_stream_t *us; 451 ngx_http_v3_uni_stream_t *us;
452 452
453 switch (type) { 453 switch (type) {
454 case NGX_HTTP_V3_STREAM_ENCODER: 454 case NGX_HTTP_V3_STREAM_ENCODER:
455 index = NGX_HTTP_V3_STREAM_SERVER_ENCODER; 455 index = NGX_HTTP_V3_STREAM_SERVER_ENCODER;
828 828
829 829
830 ngx_int_t 830 ngx_int_t
831 ngx_http_v3_set_max_push_id(ngx_connection_t *c, uint64_t max_push_id) 831 ngx_http_v3_set_max_push_id(ngx_connection_t *c, uint64_t max_push_id)
832 { 832 {
833 ngx_http_v3_connection_t *h3c; 833 ngx_http_v3_session_t *h3c;
834 834
835 h3c = ngx_http_v3_get_session(c); 835 h3c = ngx_http_v3_get_session(c);
836 836
837 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 837 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
838 "http3 MAX_PUSH_ID:%uL", max_push_id); 838 "http3 MAX_PUSH_ID:%uL", max_push_id);
848 848
849 849
850 ngx_int_t 850 ngx_int_t
851 ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id) 851 ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id)
852 { 852 {
853 ngx_queue_t *q; 853 ngx_queue_t *q;
854 ngx_http_request_t *r; 854 ngx_http_request_t *r;
855 ngx_http_v3_push_t *push; 855 ngx_http_v3_push_t *push;
856 ngx_http_v3_connection_t *h3c; 856 ngx_http_v3_session_t *h3c;
857 857
858 h3c = ngx_http_v3_get_session(c); 858 h3c = ngx_http_v3_get_session(c);
859 859
860 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 860 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
861 "http3 CANCEL_PUSH:%uL", push_id); 861 "http3 CANCEL_PUSH:%uL", push_id);