Mercurial > hg > nginx-quic
comparison src/http/v3/ngx_http_v3_streams.c @ 8360:98c4020f1c9a quic
HTTP/3: keepalive timeout.
This timeout limits the time when no client request streams exist.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 30 Mar 2021 16:48:38 +0300 |
parents | fc64ab301bad |
children | 33ec97749b5f |
comparison
equal
deleted
inserted
replaced
8359:fc64ab301bad | 8360:98c4020f1c9a |
---|---|
27 ngx_connection_t *connection; | 27 ngx_connection_t *connection; |
28 ngx_uint_t *npushing; | 28 ngx_uint_t *npushing; |
29 } ngx_http_v3_push_t; | 29 } ngx_http_v3_push_t; |
30 | 30 |
31 | 31 |
32 static void ngx_http_v3_keepalive_handler(ngx_event_t *ev); | |
33 static void ngx_http_v3_cleanup_session(void *data); | |
32 static void ngx_http_v3_close_uni_stream(ngx_connection_t *c); | 34 static void ngx_http_v3_close_uni_stream(ngx_connection_t *c); |
33 static void ngx_http_v3_read_uni_stream_type(ngx_event_t *rev); | 35 static void ngx_http_v3_read_uni_stream_type(ngx_event_t *rev); |
34 static void ngx_http_v3_uni_read_handler(ngx_event_t *rev); | 36 static void ngx_http_v3_uni_read_handler(ngx_event_t *rev); |
35 static void ngx_http_v3_dummy_write_handler(ngx_event_t *wev); | 37 static void ngx_http_v3_dummy_write_handler(ngx_event_t *wev); |
36 static void ngx_http_v3_push_cleanup(void *data); | 38 static void ngx_http_v3_push_cleanup(void *data); |
41 | 43 |
42 ngx_int_t | 44 ngx_int_t |
43 ngx_http_v3_init_session(ngx_connection_t *c) | 45 ngx_http_v3_init_session(ngx_connection_t *c) |
44 { | 46 { |
45 ngx_connection_t *pc; | 47 ngx_connection_t *pc; |
48 ngx_pool_cleanup_t *cln; | |
46 ngx_http_connection_t *phc; | 49 ngx_http_connection_t *phc; |
47 ngx_http_v3_connection_t *h3c; | 50 ngx_http_v3_connection_t *h3c; |
48 | 51 |
49 pc = c->quic->parent; | 52 pc = c->quic->parent; |
50 phc = pc->data; | 53 phc = pc->data; |
65 h3c->max_push_id = (uint64_t) -1; | 68 h3c->max_push_id = (uint64_t) -1; |
66 | 69 |
67 ngx_queue_init(&h3c->blocked); | 70 ngx_queue_init(&h3c->blocked); |
68 ngx_queue_init(&h3c->pushing); | 71 ngx_queue_init(&h3c->pushing); |
69 | 72 |
73 h3c->keepalive.log = pc->log; | |
74 h3c->keepalive.data = pc; | |
75 h3c->keepalive.handler = ngx_http_v3_keepalive_handler; | |
76 h3c->keepalive.cancelable = 1; | |
77 | |
78 cln = ngx_pool_cleanup_add(pc->pool, 0); | |
79 if (cln == NULL) { | |
80 return NGX_ERROR; | |
81 } | |
82 | |
83 cln->handler = ngx_http_v3_cleanup_session; | |
84 cln->data = h3c; | |
85 | |
70 pc->data = h3c; | 86 pc->data = h3c; |
71 | 87 |
72 return ngx_http_v3_send_settings(c); | 88 return ngx_http_v3_send_settings(c); |
89 } | |
90 | |
91 | |
92 static void | |
93 ngx_http_v3_keepalive_handler(ngx_event_t *ev) | |
94 { | |
95 ngx_connection_t *c; | |
96 | |
97 c = ev->data; | |
98 | |
99 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 keepalive handler"); | |
100 | |
101 ngx_quic_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR, | |
102 "keepalive timeout"); | |
103 } | |
104 | |
105 | |
106 static void | |
107 ngx_http_v3_cleanup_session(void *data) | |
108 { | |
109 ngx_http_v3_connection_t *h3c = data; | |
110 | |
111 if (h3c->keepalive.timer_set) { | |
112 ngx_del_timer(&h3c->keepalive); | |
113 } | |
73 } | 114 } |
74 | 115 |
75 | 116 |
76 void | 117 void |
77 ngx_http_v3_init_uni_stream(ngx_connection_t *c) | 118 ngx_http_v3_init_uni_stream(ngx_connection_t *c) |