Mercurial > hg > nginx-quic
annotate src/event/quic/ngx_event_quic_streams.c @ 8790:ad67fcc30567 quic
HTTP/3: removed useless warning regarding OpenSSL library.
After 0e6528551f26, it became impossible to run into this path.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 13 Jan 2022 15:57:15 +0300 |
parents | 5acd0d89d8c2 |
children | 3789f4a56d65 |
rev | line source |
---|---|
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
2 /* |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
3 * Copyright (C) Nginx, Inc. |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
4 */ |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
5 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
6 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
7 #include <ngx_config.h> |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
8 #include <ngx_core.h> |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
9 #include <ngx_event.h> |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
10 #include <ngx_event_quic_connection.h> |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
11 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
12 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
13 #define NGX_QUIC_STREAM_GONE (void *) -1 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
14 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
15 |
8727
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
16 static ngx_int_t ngx_quic_shutdown_stream_send(ngx_connection_t *c); |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
17 static ngx_int_t ngx_quic_shutdown_stream_recv(ngx_connection_t *c); |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
18 static ngx_quic_stream_t *ngx_quic_get_stream(ngx_connection_t *c, uint64_t id); |
8695
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
19 static ngx_int_t ngx_quic_reject_stream(ngx_connection_t *c, uint64_t id); |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
20 static void ngx_quic_init_stream_handler(ngx_event_t *ev); |
8648
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
21 static void ngx_quic_init_streams_handler(ngx_connection_t *c); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
22 static ngx_quic_stream_t *ngx_quic_create_stream(ngx_connection_t *c, |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
23 uint64_t id); |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
24 static void ngx_quic_empty_handler(ngx_event_t *ev); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
25 static ssize_t ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
26 size_t size); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
27 static ssize_t ngx_quic_stream_send(ngx_connection_t *c, u_char *buf, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
28 size_t size); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
29 static ngx_chain_t *ngx_quic_stream_send_chain(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
30 ngx_chain_t *in, off_t limit); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
31 static size_t ngx_quic_max_stream_flow(ngx_connection_t *c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
32 static void ngx_quic_stream_cleanup_handler(void *data); |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
33 static ngx_int_t ngx_quic_control_flow(ngx_connection_t *c, uint64_t last); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
34 static ngx_int_t ngx_quic_update_flow(ngx_connection_t *c, uint64_t last); |
8697
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
35 static ngx_int_t ngx_quic_update_max_stream_data(ngx_connection_t *c); |
8698
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
36 static ngx_int_t ngx_quic_update_max_data(ngx_connection_t *c); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
37 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
38 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
39 ngx_connection_t * |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
40 ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
41 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
42 uint64_t id; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
43 ngx_quic_stream_t *qs, *nqs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
44 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
45 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
46 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
47 qc = ngx_quic_get_connection(qs->parent); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
48 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
49 if (bidi) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
50 if (qc->streams.server_streams_bidi |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
51 >= qc->streams.server_max_streams_bidi) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
52 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
53 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
54 "quic too many server bidi streams:%uL", |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
55 qc->streams.server_streams_bidi); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
56 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
57 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
58 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
59 id = (qc->streams.server_streams_bidi << 2) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
60 | NGX_QUIC_STREAM_SERVER_INITIATED; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
61 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
62 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
63 "quic creating server bidi stream" |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
64 " streams:%uL max:%uL id:0x%xL", |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
65 qc->streams.server_streams_bidi, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
66 qc->streams.server_max_streams_bidi, id); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
67 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
68 qc->streams.server_streams_bidi++; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
69 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
70 } else { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
71 if (qc->streams.server_streams_uni |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
72 >= qc->streams.server_max_streams_uni) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
73 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
74 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
75 "quic too many server uni streams:%uL", |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
76 qc->streams.server_streams_uni); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
77 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
78 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
79 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
80 id = (qc->streams.server_streams_uni << 2) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
81 | NGX_QUIC_STREAM_SERVER_INITIATED |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
82 | NGX_QUIC_STREAM_UNIDIRECTIONAL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
83 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
84 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
85 "quic creating server uni stream" |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
86 " streams:%uL max:%uL id:0x%xL", |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
87 qc->streams.server_streams_uni, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
88 qc->streams.server_max_streams_uni, id); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
89 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
90 qc->streams.server_streams_uni++; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
91 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
92 |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
93 nqs = ngx_quic_create_stream(qs->parent, id); |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
94 if (nqs == NULL) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
95 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
96 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
97 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
98 return nqs->connection; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
99 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
100 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
101 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
102 void |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
103 ngx_quic_rbtree_insert_stream(ngx_rbtree_node_t *temp, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
104 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
105 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
106 ngx_rbtree_node_t **p; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
107 ngx_quic_stream_t *qn, *qnt; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
108 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
109 for ( ;; ) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
110 qn = (ngx_quic_stream_t *) node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
111 qnt = (ngx_quic_stream_t *) temp; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
112 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
113 p = (qn->id < qnt->id) ? &temp->left : &temp->right; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
114 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
115 if (*p == sentinel) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
116 break; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
117 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
118 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
119 temp = *p; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
120 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
121 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
122 *p = node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
123 node->parent = temp; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
124 node->left = sentinel; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
125 node->right = sentinel; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
126 ngx_rbt_red(node); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
127 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
128 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
129 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
130 ngx_quic_stream_t * |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
131 ngx_quic_find_stream(ngx_rbtree_t *rbtree, uint64_t id) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
132 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
133 ngx_rbtree_node_t *node, *sentinel; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
134 ngx_quic_stream_t *qn; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
135 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
136 node = rbtree->root; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
137 sentinel = rbtree->sentinel; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
138 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
139 while (node != sentinel) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
140 qn = (ngx_quic_stream_t *) node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
141 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
142 if (id == qn->id) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
143 return qn; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
144 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
145 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
146 node = (id < qn->id) ? node->left : node->right; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
147 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
148 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
149 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
150 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
151 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
152 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
153 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
154 ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
155 { |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
156 ngx_pool_t *pool; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
157 ngx_queue_t *q; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
158 ngx_event_t *rev, *wev; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
159 ngx_rbtree_t *tree; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
160 ngx_rbtree_node_t *node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
161 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
162 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
163 #if (NGX_DEBUG) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
164 ngx_uint_t ns; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
165 #endif |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
166 |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
167 while (!ngx_queue_empty(&qc->streams.uninitialized)) { |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
168 q = ngx_queue_head(&qc->streams.uninitialized); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
169 ngx_queue_remove(q); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
170 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
171 qs = ngx_queue_data(q, ngx_quic_stream_t, queue); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
172 pool = qs->connection->pool; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
173 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
174 ngx_close_connection(qs->connection); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
175 ngx_destroy_pool(pool); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
176 } |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
177 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
178 tree = &qc->streams.tree; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
179 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
180 if (tree->root == tree->sentinel) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
181 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
182 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
183 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
184 #if (NGX_DEBUG) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
185 ns = 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
186 #endif |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
187 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
188 for (node = ngx_rbtree_min(tree->root, tree->sentinel); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
189 node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
190 node = ngx_rbtree_next(tree, node)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
191 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
192 qs = (ngx_quic_stream_t *) node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
193 |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
194 rev = qs->connection->read; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
195 rev->error = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
196 rev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
197 |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
198 wev = qs->connection->write; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
199 wev->error = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
200 wev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
201 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
202 ngx_post_event(rev, &ngx_posted_events); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
203 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
204 if (rev->timer_set) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
205 ngx_del_timer(rev); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
206 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
207 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
208 #if (NGX_DEBUG) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
209 ns++; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
210 #endif |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
211 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
212 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
213 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
214 "quic connection has %ui active streams", ns); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
215 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
216 return NGX_AGAIN; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
217 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
218 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
219 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
220 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
221 ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
222 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
223 ngx_event_t *wev; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
224 ngx_connection_t *pc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
225 ngx_quic_frame_t *frame; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
226 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
227 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
228 |
8637
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
229 wev = c->write; |
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
230 |
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
231 if (wev->error) { |
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
232 return NGX_OK; |
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
233 } |
13cb758e6ac0
QUIC: reset stream only once.
Roman Arutyunyan <arut@nginx.com>
parents:
8623
diff
changeset
|
234 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
235 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
236 pc = qs->parent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
237 qc = ngx_quic_get_connection(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
238 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
239 frame = ngx_quic_alloc_frame(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
240 if (frame == NULL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
241 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
242 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
243 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
244 frame->level = ssl_encryption_application; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
245 frame->type = NGX_QUIC_FT_RESET_STREAM; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
246 frame->u.reset_stream.id = qs->id; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
247 frame->u.reset_stream.error_code = err; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
248 frame->u.reset_stream.final_size = c->sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
249 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
250 ngx_quic_queue_frame(qc, frame); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
251 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
252 wev->error = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
253 wev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
254 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
255 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
256 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
257 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
258 |
8679
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
259 ngx_int_t |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
260 ngx_quic_shutdown_stream(ngx_connection_t *c, int how) |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
261 { |
8727
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
262 ngx_quic_stream_t *qs; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
263 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
264 qs = c->quic; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
265 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
266 if (how == NGX_RDWR_SHUTDOWN || how == NGX_WRITE_SHUTDOWN) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
267 if ((qs->id & NGX_QUIC_STREAM_SERVER_INITIATED) |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
268 || (qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0) |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
269 { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
270 if (ngx_quic_shutdown_stream_send(c) != NGX_OK) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
271 return NGX_ERROR; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
272 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
273 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
274 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
275 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
276 if (how == NGX_RDWR_SHUTDOWN || how == NGX_READ_SHUTDOWN) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
277 if ((qs->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
278 || (qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0) |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
279 { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
280 if (ngx_quic_shutdown_stream_recv(c) != NGX_OK) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
281 return NGX_ERROR; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
282 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
283 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
284 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
285 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
286 return NGX_OK; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
287 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
288 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
289 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
290 static ngx_int_t |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
291 ngx_quic_shutdown_stream_send(ngx_connection_t *c) |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
292 { |
8679
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
293 ngx_event_t *wev; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
294 ngx_connection_t *pc; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
295 ngx_quic_frame_t *frame; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
296 ngx_quic_stream_t *qs; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
297 ngx_quic_connection_t *qc; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
298 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
299 wev = c->write; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
300 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
301 if (wev->error) { |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
302 return NGX_OK; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
303 } |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
304 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
305 qs = c->quic; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
306 pc = qs->parent; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
307 qc = ngx_quic_get_connection(pc); |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
308 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
309 frame = ngx_quic_alloc_frame(pc); |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
310 if (frame == NULL) { |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
311 return NGX_ERROR; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
312 } |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
313 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
314 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
8727
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
315 "quic stream id:0x%xL send shutdown", qs->id); |
8679
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
316 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
317 frame->level = ssl_encryption_application; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
318 frame->type = NGX_QUIC_FT_STREAM; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
319 frame->u.stream.off = 1; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
320 frame->u.stream.len = 1; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
321 frame->u.stream.fin = 1; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
322 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
323 frame->u.stream.stream_id = qs->id; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
324 frame->u.stream.offset = c->sent; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
325 frame->u.stream.length = 0; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
326 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
327 ngx_quic_queue_frame(qc, frame); |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
328 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
329 wev->error = 1; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
330 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
331 return NGX_OK; |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
332 } |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
333 |
b4c7853b0488
QUIC: added shutdown support in stream proxy.
Vladimir Homutov <vl@nginx.com>
parents:
8648
diff
changeset
|
334 |
8727
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
335 static ngx_int_t |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
336 ngx_quic_shutdown_stream_recv(ngx_connection_t *c) |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
337 { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
338 ngx_event_t *rev; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
339 ngx_connection_t *pc; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
340 ngx_quic_frame_t *frame; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
341 ngx_quic_stream_t *qs; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
342 ngx_quic_connection_t *qc; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
343 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
344 rev = c->read; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
345 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
346 if (rev->pending_eof || rev->error) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
347 return NGX_OK; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
348 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
349 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
350 qs = c->quic; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
351 pc = qs->parent; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
352 qc = ngx_quic_get_connection(pc); |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
353 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
354 if (qc->conf->stream_close_code == 0) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
355 return NGX_OK; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
356 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
357 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
358 frame = ngx_quic_alloc_frame(pc); |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
359 if (frame == NULL) { |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
360 return NGX_ERROR; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
361 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
362 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
363 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
364 "quic stream id:0x%xL recv shutdown", qs->id); |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
365 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
366 frame->level = ssl_encryption_application; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
367 frame->type = NGX_QUIC_FT_STOP_SENDING; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
368 frame->u.stop_sending.id = qs->id; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
369 frame->u.stop_sending.error_code = qc->conf->stream_close_code; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
370 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
371 ngx_quic_queue_frame(qc, frame); |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
372 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
373 rev->error = 1; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
374 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
375 return NGX_OK; |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
376 } |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
377 |
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
378 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
379 static ngx_quic_stream_t * |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
380 ngx_quic_get_stream(ngx_connection_t *c, uint64_t id) |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
381 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
382 uint64_t min_id; |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
383 ngx_event_t *rev; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
384 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
385 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
386 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
387 qc = ngx_quic_get_connection(c); |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
388 |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
389 qs = ngx_quic_find_stream(&qc->streams.tree, id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
390 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
391 if (qs) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
392 return qs; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
393 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
394 |
8694
832723a49026
QUIC: stop processing new client streams at the closing state.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8679
diff
changeset
|
395 if (qc->shutdown || qc->closing) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
396 return NGX_QUIC_STREAM_GONE; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
397 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
398 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
399 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
400 "quic stream id:0x%xL is missing", id); |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
401 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
402 if (id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
403 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
404 if (id & NGX_QUIC_STREAM_SERVER_INITIATED) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
405 if ((id >> 2) < qc->streams.server_streams_uni) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
406 return NGX_QUIC_STREAM_GONE; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
407 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
408 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
409 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
410 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
411 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
412 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
413 if ((id >> 2) < qc->streams.client_streams_uni) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
414 return NGX_QUIC_STREAM_GONE; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
415 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
416 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
417 if ((id >> 2) >= qc->streams.client_max_streams_uni) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
418 qc->error = NGX_QUIC_ERR_STREAM_LIMIT_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
419 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
420 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
421 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
422 min_id = (qc->streams.client_streams_uni << 2) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
423 | NGX_QUIC_STREAM_UNIDIRECTIONAL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
424 qc->streams.client_streams_uni = (id >> 2) + 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
425 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
426 } else { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
427 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
428 if (id & NGX_QUIC_STREAM_SERVER_INITIATED) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
429 if ((id >> 2) < qc->streams.server_streams_bidi) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
430 return NGX_QUIC_STREAM_GONE; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
431 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
432 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
433 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
434 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
435 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
436 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
437 if ((id >> 2) < qc->streams.client_streams_bidi) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
438 return NGX_QUIC_STREAM_GONE; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
439 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
440 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
441 if ((id >> 2) >= qc->streams.client_max_streams_bidi) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
442 qc->error = NGX_QUIC_ERR_STREAM_LIMIT_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
443 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
444 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
445 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
446 min_id = (qc->streams.client_streams_bidi << 2); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
447 qc->streams.client_streams_bidi = (id >> 2) + 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
448 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
449 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
450 /* |
8498
4715f3e669f1
QUIC: updated specification references.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8492
diff
changeset
|
451 * RFC 9000, 2.1. Stream Types and Identifiers |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
452 * |
8498
4715f3e669f1
QUIC: updated specification references.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8492
diff
changeset
|
453 * successive streams of each type are created with numerically increasing |
4715f3e669f1
QUIC: updated specification references.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8492
diff
changeset
|
454 * stream IDs. A stream ID that is used out of order results in all |
4715f3e669f1
QUIC: updated specification references.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8492
diff
changeset
|
455 * streams of that type with lower-numbered stream IDs also being opened. |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
456 */ |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
457 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
458 #if (NGX_SUPPRESS_WARN) |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
459 qs = NULL; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
460 #endif |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
461 |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
462 for ( /* void */ ; min_id <= id; min_id += 0x04) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
463 |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
464 qs = ngx_quic_create_stream(c, min_id); |
8695
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
465 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
466 if (qs == NULL) { |
8695
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
467 if (ngx_quic_reject_stream(c, min_id) != NGX_OK) { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
468 return NULL; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
469 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
470 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
471 continue; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
472 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
473 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
474 ngx_queue_insert_tail(&qc->streams.uninitialized, &qs->queue); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
475 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
476 rev = qs->connection->read; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
477 rev->handler = ngx_quic_init_stream_handler; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
478 |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
479 if (qc->streams.initialized) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
480 ngx_post_event(rev, &ngx_posted_events); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
481 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
482 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
483 |
8695
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
484 if (qs == NULL) { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
485 return NGX_QUIC_STREAM_GONE; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
486 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
487 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
488 return qs; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
489 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
490 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
491 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
492 static ngx_int_t |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
493 ngx_quic_reject_stream(ngx_connection_t *c, uint64_t id) |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
494 { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
495 uint64_t code; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
496 ngx_quic_frame_t *frame; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
497 ngx_quic_connection_t *qc; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
498 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
499 qc = ngx_quic_get_connection(c); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
500 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
501 code = (id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
502 ? qc->conf->stream_reject_code_uni |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
503 : qc->conf->stream_reject_code_bidi; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
504 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
505 if (code == 0) { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
506 return NGX_DECLINED; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
507 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
508 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
509 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
510 "quic stream id:0x%xL reject err:0x%xL", id, code); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
511 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
512 frame = ngx_quic_alloc_frame(c); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
513 if (frame == NULL) { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
514 return NGX_ERROR; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
515 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
516 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
517 frame->level = ssl_encryption_application; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
518 frame->type = NGX_QUIC_FT_RESET_STREAM; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
519 frame->u.reset_stream.id = id; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
520 frame->u.reset_stream.error_code = code; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
521 frame->u.reset_stream.final_size = 0; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
522 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
523 ngx_quic_queue_frame(qc, frame); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
524 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
525 frame = ngx_quic_alloc_frame(c); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
526 if (frame == NULL) { |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
527 return NGX_ERROR; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
528 } |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
529 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
530 frame->level = ssl_encryption_application; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
531 frame->type = NGX_QUIC_FT_STOP_SENDING; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
532 frame->u.stop_sending.id = id; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
533 frame->u.stop_sending.error_code = code; |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
534 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
535 ngx_quic_queue_frame(qc, frame); |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
536 |
41caf5410110
QUIC: reject streams which we could not create.
Roman Arutyunyan <arut@nginx.com>
parents:
8694
diff
changeset
|
537 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
538 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
539 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
540 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
541 static void |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
542 ngx_quic_init_stream_handler(ngx_event_t *ev) |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
543 { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
544 ngx_connection_t *c; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
545 ngx_quic_stream_t *qs; |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
546 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
547 c = ev->data; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
548 qs = c->quic; |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
549 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
550 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic init stream"); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
551 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
552 ngx_queue_remove(&qs->queue); |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
553 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
554 c->listening->handler(c); |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
555 } |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
556 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
557 |
8648
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
558 ngx_int_t |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
559 ngx_quic_init_streams(ngx_connection_t *c) |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
560 { |
8648
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
561 ngx_int_t rc; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
562 ngx_quic_connection_t *qc; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
563 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
564 qc = ngx_quic_get_connection(c); |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
565 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
566 if (qc->streams.initialized) { |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
567 return NGX_OK; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
568 } |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
569 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
570 rc = ngx_ssl_ocsp_validate(c); |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
571 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
572 if (rc == NGX_ERROR) { |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
573 return NGX_ERROR; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
574 } |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
575 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
576 if (rc == NGX_AGAIN) { |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
577 c->ssl->handler = ngx_quic_init_streams_handler; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
578 return NGX_OK; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
579 } |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
580 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
581 ngx_quic_init_streams_handler(c); |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
582 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
583 return NGX_OK; |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
584 } |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
585 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
586 |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
587 static void |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
588 ngx_quic_init_streams_handler(ngx_connection_t *c) |
66b4ff373dd9
QUIC: refactored OCSP validation in preparation for 0-RTT support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8638
diff
changeset
|
589 { |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
590 ngx_queue_t *q; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
591 ngx_quic_stream_t *qs; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
592 ngx_quic_connection_t *qc; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
593 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
594 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic init streams"); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
595 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
596 qc = ngx_quic_get_connection(c); |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
597 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
598 for (q = ngx_queue_head(&qc->streams.uninitialized); |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
599 q != ngx_queue_sentinel(&qc->streams.uninitialized); |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
600 q = ngx_queue_next(q)) |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
601 { |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
602 qs = ngx_queue_data(q, ngx_quic_stream_t, queue); |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
603 ngx_post_event(qs->connection->read, &ngx_posted_events); |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
604 } |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
605 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
606 qc->streams.initialized = 1; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
607 } |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
608 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
609 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
610 static ngx_quic_stream_t * |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
611 ngx_quic_create_stream(ngx_connection_t *c, uint64_t id) |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
612 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
613 ngx_log_t *log; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
614 ngx_pool_t *pool; |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
615 ngx_connection_t *sc; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
616 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
617 ngx_pool_cleanup_t *cln; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
618 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
619 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
620 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
621 "quic stream id:0x%xL create", id); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
622 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
623 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
624 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
625 pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, c->log); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
626 if (pool == NULL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
627 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
628 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
629 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
630 qs = ngx_pcalloc(pool, sizeof(ngx_quic_stream_t)); |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
631 if (qs == NULL) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
632 ngx_destroy_pool(pool); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
633 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
634 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
635 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
636 qs->node.key = id; |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
637 qs->parent = c; |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
638 qs->id = id; |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
639 qs->final_size = (uint64_t) -1; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
640 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
641 log = ngx_palloc(pool, sizeof(ngx_log_t)); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
642 if (log == NULL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
643 ngx_destroy_pool(pool); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
644 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
645 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
646 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
647 *log = *c->log; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
648 pool->log = log; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
649 |
8622
a2cef164a924
QUIC: simplified stream fd initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8617
diff
changeset
|
650 sc = ngx_get_connection(c->fd, log); |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
651 if (sc == NULL) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
652 ngx_destroy_pool(pool); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
653 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
654 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
655 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
656 qs->connection = sc; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
657 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
658 sc->quic = qs; |
8597
486c6a9be111
QUIC: store QUIC connection fd in stream fake connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8596
diff
changeset
|
659 sc->shared = 1; |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
660 sc->type = SOCK_STREAM; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
661 sc->pool = pool; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
662 sc->ssl = c->ssl; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
663 sc->sockaddr = c->sockaddr; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
664 sc->listening = c->listening; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
665 sc->addr_text = c->addr_text; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
666 sc->local_sockaddr = c->local_sockaddr; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
667 sc->local_socklen = c->local_socklen; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
668 sc->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); |
8623
630ecd703805
QUIC: set NGX_TCP_NODELAY_DISABLED for fake stream connections.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8622
diff
changeset
|
669 sc->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
670 |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
671 sc->recv = ngx_quic_stream_recv; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
672 sc->send = ngx_quic_stream_send; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
673 sc->send_chain = ngx_quic_stream_send_chain; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
674 |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
675 sc->read->log = log; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
676 sc->write->log = log; |
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
677 |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
678 sc->read->handler = ngx_quic_empty_handler; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
679 sc->write->handler = ngx_quic_empty_handler; |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
680 |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
681 log->connection = sc->number; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
682 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
683 if ((id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
684 || (id & NGX_QUIC_STREAM_SERVER_INITIATED)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
685 { |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
686 sc->write->ready = 1; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
687 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
688 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
689 if (id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
690 if (id & NGX_QUIC_STREAM_SERVER_INITIATED) { |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
691 qs->send_max_data = qc->ctp.initial_max_stream_data_uni; |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
692 |
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
693 } else { |
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
694 qs->recv_max_data = qc->tp.initial_max_stream_data_uni; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
695 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
696 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
697 } else { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
698 if (id & NGX_QUIC_STREAM_SERVER_INITIATED) { |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
699 qs->send_max_data = qc->ctp.initial_max_stream_data_bidi_remote; |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
700 qs->recv_max_data = qc->tp.initial_max_stream_data_bidi_local; |
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
701 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
702 } else { |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
703 qs->send_max_data = qc->ctp.initial_max_stream_data_bidi_local; |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
704 qs->recv_max_data = qc->tp.initial_max_stream_data_bidi_remote; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
705 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
706 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
707 |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
708 qs->recv_window = qs->recv_max_data; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
709 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
710 cln = ngx_pool_cleanup_add(pool, 0); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
711 if (cln == NULL) { |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
712 ngx_close_connection(sc); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
713 ngx_destroy_pool(pool); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
714 return NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
715 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
716 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
717 cln->handler = ngx_quic_stream_cleanup_handler; |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
718 cln->data = sc; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
719 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
720 ngx_rbtree_insert(&qc->streams.tree, &qs->node); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
721 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
722 return qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
723 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
724 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
725 |
8552
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
726 static void |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
727 ngx_quic_empty_handler(ngx_event_t *ev) |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
728 { |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
729 } |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
730 |
fe919fd63b0b
QUIC: client certificate validation with OCSP.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8545
diff
changeset
|
731 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
732 static ssize_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
733 ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
734 { |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
735 ssize_t len; |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
736 ngx_buf_t *b; |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
737 ngx_chain_t *cl, *in; |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
738 ngx_event_t *rev; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
739 ngx_connection_t *pc; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
740 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
741 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
742 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
743 pc = qs->parent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
744 rev = c->read; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
745 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
746 if (rev->error) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
747 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
748 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
749 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
750 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
751 "quic stream id:0x%xL recv eof:%d buf:%uz", |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
752 qs->id, rev->pending_eof, size); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
753 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
754 if (qs->in == NULL || qs->in->buf->sync) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
755 rev->ready = 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
756 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
757 if (qs->recv_offset == qs->final_size) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
758 rev->eof = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
759 return 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
760 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
761 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
762 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
763 "quic stream id:0x%xL recv() not ready", qs->id); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
764 return NGX_AGAIN; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
765 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
766 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
767 in = ngx_quic_read_chain(pc, &qs->in, size); |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
768 if (in == NGX_CHAIN_ERROR) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
769 return NGX_ERROR; |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
770 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
771 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
772 len = 0; |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
773 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
774 for (cl = in; cl; cl = cl->next) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
775 b = cl->buf; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
776 len += b->last - b->pos; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
777 buf = ngx_cpymem(buf, b->pos, b->last - b->pos); |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
778 } |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
779 |
8761
19e063e955bf
QUIC: renamed buffer-related functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8760
diff
changeset
|
780 ngx_quic_free_chain(pc, in); |
8439
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
781 |
f52a2b77d406
QUIC: generic buffering for stream input.
Roman Arutyunyan <arut@nginx.com>
parents:
8421
diff
changeset
|
782 if (qs->in == NULL) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
783 rev->ready = rev->pending_eof; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
784 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
785 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
786 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
787 "quic stream id:0x%xL recv len:%z", qs->id, len); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
788 |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
789 if (ngx_quic_update_flow(c, qs->recv_offset + len) != NGX_OK) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
790 return NGX_ERROR; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
791 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
792 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
793 return len; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
794 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
795 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
796 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
797 static ssize_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
798 ngx_quic_stream_send(ngx_connection_t *c, u_char *buf, size_t size) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
799 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
800 ngx_buf_t b; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
801 ngx_chain_t cl; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
802 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
803 ngx_memzero(&b, sizeof(ngx_buf_t)); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
804 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
805 b.memory = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
806 b.pos = buf; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
807 b.last = buf + size; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
808 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
809 cl.buf = &b; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
810 cl.next = NULL; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
811 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
812 if (ngx_quic_stream_send_chain(c, &cl, 0) == NGX_CHAIN_ERROR) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
813 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
814 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
815 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
816 if (b.pos == buf) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
817 return NGX_AGAIN; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
818 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
819 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
820 return b.pos - buf; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
821 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
822 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
823 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
824 static ngx_chain_t * |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
825 ngx_quic_stream_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
826 { |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
827 off_t n, flow; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
828 ngx_event_t *wev; |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
829 ngx_chain_t *out, *cl; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
830 ngx_connection_t *pc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
831 ngx_quic_frame_t *frame; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
832 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
833 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
834 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
835 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
836 pc = qs->parent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
837 qc = ngx_quic_get_connection(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
838 wev = c->write; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
839 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
840 if (wev->error) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
841 return NGX_CHAIN_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
842 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
843 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
844 flow = ngx_quic_max_stream_flow(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
845 if (flow == 0) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
846 wev->ready = 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
847 return in; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
848 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
849 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
850 if (limit == 0 || limit > flow) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
851 limit = flow; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
852 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
853 |
8759
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
854 n = 0; |
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
855 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
856 for (cl = in; cl; cl = cl->next) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
857 n += cl->buf->last - cl->buf->pos; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
858 if (n >= limit) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
859 n = limit; |
8759
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
860 break; |
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
861 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
862 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
863 |
8789
5acd0d89d8c2
QUIC: fixed handling stream input buffers.
Roman Arutyunyan <arut@nginx.com>
parents:
8788
diff
changeset
|
864 in = ngx_quic_write_chain(pc, &qs->out, in, limit, 0); |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
865 if (in == NGX_CHAIN_ERROR) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
866 return NGX_CHAIN_ERROR; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
867 } |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
868 |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
869 out = ngx_quic_read_chain(pc, &qs->out, n); |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
870 if (out == NGX_CHAIN_ERROR) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
871 return NGX_CHAIN_ERROR; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
872 } |
8759
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
873 |
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
874 frame = ngx_quic_alloc_frame(pc); |
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
875 if (frame == NULL) { |
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
876 return NGX_CHAIN_ERROR; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
877 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
878 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
879 frame->level = ssl_encryption_application; |
8545
4009f120cad4
QUIC: eliminated stream type from ngx_quic_stream_frame_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8498
diff
changeset
|
880 frame->type = NGX_QUIC_FT_STREAM; |
8759
56dec0d4e5b1
QUIC: avoid excessive buffer allocations in stream output.
Roman Arutyunyan <arut@nginx.com>
parents:
8727
diff
changeset
|
881 frame->data = out; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
882 frame->u.stream.off = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
883 frame->u.stream.len = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
884 frame->u.stream.fin = 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
885 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
886 frame->u.stream.stream_id = qs->id; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
887 frame->u.stream.offset = c->sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
888 frame->u.stream.length = n; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
889 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
890 c->sent += n; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
891 qc->streams.sent += n; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
892 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
893 ngx_quic_queue_frame(qc, frame); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
894 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
895 if (in) { |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
896 wev->ready = 0; |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
897 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
898 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
899 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
8765
d78972cf4bac
QUIC: fixed format specifier after 6ccf3867959a.
Roman Arutyunyan <arut@nginx.com>
parents:
8761
diff
changeset
|
900 "quic send_chain sent:%O", n); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
901 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
902 return in; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
903 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
904 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
905 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
906 static size_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
907 ngx_quic_max_stream_flow(ngx_connection_t *c) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
908 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
909 size_t size; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
910 uint64_t sent, unacked; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
911 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
912 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
913 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
914 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
915 qc = ngx_quic_get_connection(qs->parent); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
916 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8698
diff
changeset
|
917 size = qc->conf->stream_buffer_size; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
918 sent = c->sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
919 unacked = sent - qs->acked; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
920 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
921 if (qc->streams.send_max_data == 0) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
922 qc->streams.send_max_data = qc->ctp.initial_max_data; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
923 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
924 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8698
diff
changeset
|
925 if (unacked >= size) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
926 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
927 "quic send flow hit buffer size"); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
928 return 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
929 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
930 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8698
diff
changeset
|
931 size -= unacked; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
932 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
933 if (qc->streams.sent >= qc->streams.send_max_data) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
934 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
935 "quic send flow hit MAX_DATA"); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
936 return 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
937 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
938 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
939 if (qc->streams.sent + size > qc->streams.send_max_data) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
940 size = qc->streams.send_max_data - qc->streams.sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
941 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
942 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
943 if (sent >= qs->send_max_data) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
944 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
945 "quic send flow hit MAX_STREAM_DATA"); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
946 return 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
947 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
948 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
949 if (sent + size > qs->send_max_data) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
950 size = qs->send_max_data - sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
951 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
952 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
953 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
954 "quic send flow:%uz", size); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
955 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
956 return size; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
957 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
958 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
959 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
960 static void |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
961 ngx_quic_stream_cleanup_handler(void *data) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
962 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
963 ngx_connection_t *c = data; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
964 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
965 ngx_connection_t *pc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
966 ngx_quic_frame_t *frame; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
967 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
968 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
969 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
970 qs = c->quic; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
971 pc = qs->parent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
972 qc = ngx_quic_get_connection(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
973 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
974 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
975 "quic stream id:0x%xL cleanup", qs->id); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
976 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
977 ngx_rbtree_delete(&qc->streams.tree, &qs->node); |
8761
19e063e955bf
QUIC: renamed buffer-related functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8760
diff
changeset
|
978 ngx_quic_free_chain(pc, qs->in); |
19e063e955bf
QUIC: renamed buffer-related functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8760
diff
changeset
|
979 ngx_quic_free_chain(pc, qs->out); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
980 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
981 if (qc->closing) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
982 /* schedule handler call to continue ngx_quic_close_connection() */ |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
983 ngx_post_event(pc->read, &ngx_posted_events); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
984 return; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
985 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
986 |
8416
e29b7508b8b3
QUIC: avoid sending extra frames in case of error.
Vladimir Homutov <vl@nginx.com>
parents:
8415
diff
changeset
|
987 if (qc->error) { |
e29b7508b8b3
QUIC: avoid sending extra frames in case of error.
Vladimir Homutov <vl@nginx.com>
parents:
8415
diff
changeset
|
988 goto done; |
e29b7508b8b3
QUIC: avoid sending extra frames in case of error.
Vladimir Homutov <vl@nginx.com>
parents:
8415
diff
changeset
|
989 } |
e29b7508b8b3
QUIC: avoid sending extra frames in case of error.
Vladimir Homutov <vl@nginx.com>
parents:
8415
diff
changeset
|
990 |
8727
23880e4ad3e2
QUIC: write and full stream shutdown support.
Roman Arutyunyan <arut@nginx.com>
parents:
8726
diff
changeset
|
991 (void) ngx_quic_shutdown_stream(c, NGX_RDWR_SHUTDOWN); |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
992 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
993 (void) ngx_quic_update_flow(c, qs->recv_last); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
994 |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
995 if ((qs->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
996 frame = ngx_quic_alloc_frame(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
997 if (frame == NULL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
998 goto done; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
999 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1000 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1001 frame->level = ssl_encryption_application; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1002 frame->type = NGX_QUIC_FT_MAX_STREAMS; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1003 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1004 if (qs->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1005 frame->u.max_streams.limit = ++qc->streams.client_max_streams_uni; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1006 frame->u.max_streams.bidi = 0; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1007 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1008 } else { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1009 frame->u.max_streams.limit = ++qc->streams.client_max_streams_bidi; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1010 frame->u.max_streams.bidi = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1011 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1012 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1013 ngx_quic_queue_frame(qc, frame); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1014 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1015 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1016 done: |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1017 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1018 (void) ngx_quic_output(pc); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1019 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1020 if (qc->shutdown) { |
8553
a9f6540e61da
QUIC: asynchronous shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8552
diff
changeset
|
1021 ngx_post_event(pc->read, &ngx_posted_events); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1022 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1023 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1024 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1025 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1026 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1027 ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1028 ngx_quic_frame_t *frame) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1029 { |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1030 uint64_t last; |
8444
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1031 ngx_event_t *rev; |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1032 ngx_connection_t *sc; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1033 ngx_quic_stream_t *qs; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1034 ngx_quic_connection_t *qc; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1035 ngx_quic_stream_frame_t *f; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1036 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1037 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1038 f = &frame->u.stream; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1039 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1040 if ((f->stream_id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1041 && (f->stream_id & NGX_QUIC_STREAM_SERVER_INITIATED)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1042 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1043 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1044 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1045 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1046 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1047 /* no overflow since both values are 62-bit */ |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1048 last = f->offset + f->length; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1049 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1050 qs = ngx_quic_get_stream(c, f->stream_id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1051 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1052 if (qs == NULL) { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1053 return NGX_ERROR; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1054 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1055 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1056 if (qs == NGX_QUIC_STREAM_GONE) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1057 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1058 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1059 |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1060 sc = qs->connection; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1061 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1062 rev = sc->read; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1063 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1064 if (rev->error) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1065 return NGX_OK; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1066 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1067 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1068 if (ngx_quic_control_flow(sc, last) != NGX_OK) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1069 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1070 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1071 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1072 if (qs->final_size != (uint64_t) -1 && last > qs->final_size) { |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1073 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1074 return NGX_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1075 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1076 |
8788
47f45a98f892
QUIC: fixed handling STREAM FIN.
Roman Arutyunyan <arut@nginx.com>
parents:
8765
diff
changeset
|
1077 if (last < qs->recv_offset) { |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1078 return NGX_OK; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1079 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1080 |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1081 if (f->offset < qs->recv_offset) { |
8761
19e063e955bf
QUIC: renamed buffer-related functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8760
diff
changeset
|
1082 ngx_quic_trim_chain(frame->data, qs->recv_offset - f->offset); |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1083 f->offset = qs->recv_offset; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1084 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1085 |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1086 if (f->fin) { |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1087 if (qs->final_size != (uint64_t) -1 && qs->final_size != last) { |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1088 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1089 return NGX_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1090 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1091 |
8443
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1092 if (qs->recv_last > last) { |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1093 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1094 return NGX_ERROR; |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1095 } |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1096 |
8444
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1097 rev->pending_eof = 1; |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1098 qs->final_size = last; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1099 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1100 |
8760
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
1101 if (ngx_quic_write_chain(c, &qs->in, frame->data, f->length, |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
1102 f->offset - qs->recv_offset) |
6ccf3867959a
QUIC: refactored ngx_quic_order_bufs() and ngx_quic_split_bufs().
Roman Arutyunyan <arut@nginx.com>
parents:
8759
diff
changeset
|
1103 == NGX_CHAIN_ERROR) |
8444
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1104 { |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1105 return NGX_ERROR; |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1106 } |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1107 |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1108 if (f->offset == qs->recv_offset) { |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1109 rev->ready = 1; |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1110 |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1111 if (rev->active) { |
8725
86f5a738ac2a
QUIC: post stream events instead of calling their handlers.
Roman Arutyunyan <arut@nginx.com>
parents:
8713
diff
changeset
|
1112 ngx_post_event(rev, &ngx_posted_events); |
8444
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1113 } |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1114 } |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1115 |
7d32c3c93678
QUIC: call stream read handler on new data arrival.
Roman Arutyunyan <arut@nginx.com>
parents:
8443
diff
changeset
|
1116 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1117 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1118 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1119 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1120 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1121 ngx_quic_handle_max_data_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1122 ngx_quic_max_data_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1123 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1124 ngx_event_t *wev; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1125 ngx_rbtree_t *tree; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1126 ngx_rbtree_node_t *node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1127 ngx_quic_stream_t *qs; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1128 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1129 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1130 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1131 tree = &qc->streams.tree; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1132 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1133 if (f->max_data <= qc->streams.send_max_data) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1134 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1135 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1136 |
8596
1f7f98638dc2
QUIC: fixed null pointer dereference in MAX_DATA handler.
Mariano Di Martino <mariano.dimartino@uhasselt.be>
parents:
8553
diff
changeset
|
1137 if (tree->root != tree->sentinel |
1f7f98638dc2
QUIC: fixed null pointer dereference in MAX_DATA handler.
Mariano Di Martino <mariano.dimartino@uhasselt.be>
parents:
8553
diff
changeset
|
1138 && qc->streams.sent >= qc->streams.send_max_data) |
1f7f98638dc2
QUIC: fixed null pointer dereference in MAX_DATA handler.
Mariano Di Martino <mariano.dimartino@uhasselt.be>
parents:
8553
diff
changeset
|
1139 { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1140 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1141 for (node = ngx_rbtree_min(tree->root, tree->sentinel); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1142 node; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1143 node = ngx_rbtree_next(tree, node)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1144 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1145 qs = (ngx_quic_stream_t *) node; |
8420
baf9551b4a5b
QUIC: renamed stream field from c to connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8416
diff
changeset
|
1146 wev = qs->connection->write; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1147 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1148 if (wev->active) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1149 wev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1150 ngx_post_event(wev, &ngx_posted_events); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1151 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1152 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1153 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1154 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1155 qc->streams.send_max_data = f->max_data; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1156 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1157 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1158 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1159 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1160 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1161 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1162 ngx_quic_handle_streams_blocked_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1163 ngx_quic_header_t *pkt, ngx_quic_streams_blocked_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1164 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1165 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1166 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1167 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1168 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1169 ngx_int_t |
8698
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1170 ngx_quic_handle_data_blocked_frame(ngx_connection_t *c, |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1171 ngx_quic_header_t *pkt, ngx_quic_data_blocked_frame_t *f) |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1172 { |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1173 return ngx_quic_update_max_data(c); |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1174 } |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1175 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1176 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1177 ngx_int_t |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1178 ngx_quic_handle_stream_data_blocked_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1179 ngx_quic_header_t *pkt, ngx_quic_stream_data_blocked_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1180 { |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1181 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1182 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1183 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1184 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1185 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1186 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1187 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1188 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1189 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1190 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1191 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1192 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1193 qs = ngx_quic_get_stream(c, f->id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1194 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1195 if (qs == NULL) { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1196 return NGX_ERROR; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1197 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1198 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1199 if (qs == NGX_QUIC_STREAM_GONE) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1200 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1201 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1202 |
8697
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1203 return ngx_quic_update_max_stream_data(qs->connection); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1204 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1205 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1206 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1207 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1208 ngx_quic_handle_max_stream_data_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1209 ngx_quic_header_t *pkt, ngx_quic_max_stream_data_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1210 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1211 uint64_t sent; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1212 ngx_event_t *wev; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1213 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1214 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1215 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1216 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1217 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1218 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1219 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1220 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1221 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1222 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1223 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1224 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1225 qs = ngx_quic_get_stream(c, f->id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1226 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1227 if (qs == NULL) { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1228 return NGX_ERROR; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1229 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1230 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1231 if (qs == NGX_QUIC_STREAM_GONE) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1232 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1233 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1234 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1235 if (f->limit <= qs->send_max_data) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1236 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1237 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1238 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1239 sent = qs->connection->sent; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1240 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1241 if (sent >= qs->send_max_data) { |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1242 wev = qs->connection->write; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1243 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1244 if (wev->active) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1245 wev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1246 ngx_post_event(wev, &ngx_posted_events); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1247 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1248 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1249 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1250 qs->send_max_data = f->limit; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1251 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1252 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1253 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1254 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1255 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1256 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1257 ngx_quic_handle_reset_stream_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1258 ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1259 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1260 ngx_event_t *rev; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1261 ngx_connection_t *sc; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1262 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1263 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1264 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1265 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1266 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1267 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1268 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED)) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1269 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1270 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1271 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1272 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1273 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1274 qs = ngx_quic_get_stream(c, f->id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1275 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1276 if (qs == NULL) { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1277 return NGX_ERROR; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1278 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1279 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1280 if (qs == NGX_QUIC_STREAM_GONE) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1281 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1282 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1283 |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1284 sc = qs->connection; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1285 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1286 rev = sc->read; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1287 rev->error = 1; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1288 rev->ready = 1; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1289 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1290 if (ngx_quic_control_flow(sc, f->final_size) != NGX_OK) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1291 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1292 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1293 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1294 if (qs->final_size != (uint64_t) -1 && qs->final_size != f->final_size) { |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1295 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1296 return NGX_ERROR; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1297 } |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1298 |
8443
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1299 if (qs->recv_last > f->final_size) { |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1300 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1301 return NGX_ERROR; |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1302 } |
60c6e8d8d3ae
QUIC: make sure stream data size is lower than final size.
Roman Arutyunyan <arut@nginx.com>
parents:
8442
diff
changeset
|
1303 |
8442
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1304 qs->final_size = f->final_size; |
b3f6ad181df4
QUIC: refactored CRYPTO and STREAM buffer ordering.
Roman Arutyunyan <arut@nginx.com>
parents:
8439
diff
changeset
|
1305 |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1306 if (ngx_quic_update_flow(sc, qs->final_size) != NGX_OK) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1307 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1308 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1309 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1310 if (rev->active) { |
8725
86f5a738ac2a
QUIC: post stream events instead of calling their handlers.
Roman Arutyunyan <arut@nginx.com>
parents:
8713
diff
changeset
|
1311 ngx_post_event(rev, &ngx_posted_events); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1312 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1313 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1314 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1315 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1316 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1317 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1318 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1319 ngx_quic_handle_stop_sending_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1320 ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1321 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1322 ngx_event_t *wev; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1323 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1324 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1325 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1326 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1327 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1328 if ((f->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1329 && (f->id & NGX_QUIC_STREAM_SERVER_INITIATED) == 0) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1330 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1331 qc->error = NGX_QUIC_ERR_STREAM_STATE_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1332 return NGX_ERROR; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1333 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1334 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1335 qs = ngx_quic_get_stream(c, f->id); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1336 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1337 if (qs == NULL) { |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1338 return NGX_ERROR; |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1339 } |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1340 |
8726
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1341 if (qs == NGX_QUIC_STREAM_GONE) { |
0692355a3519
QUIC: simplified stream initialization.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
1342 return NGX_OK; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1343 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1344 |
8638
1ead7d64e993
QUIC: send RESET_STREAM in response to STOP_SENDING.
Roman Arutyunyan <arut@nginx.com>
parents:
8637
diff
changeset
|
1345 if (ngx_quic_reset_stream(qs->connection, f->error_code) != NGX_OK) { |
1ead7d64e993
QUIC: send RESET_STREAM in response to STOP_SENDING.
Roman Arutyunyan <arut@nginx.com>
parents:
8637
diff
changeset
|
1346 return NGX_ERROR; |
1ead7d64e993
QUIC: send RESET_STREAM in response to STOP_SENDING.
Roman Arutyunyan <arut@nginx.com>
parents:
8637
diff
changeset
|
1347 } |
1ead7d64e993
QUIC: send RESET_STREAM in response to STOP_SENDING.
Roman Arutyunyan <arut@nginx.com>
parents:
8637
diff
changeset
|
1348 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1349 wev = qs->connection->write; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1350 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1351 if (wev->active) { |
8725
86f5a738ac2a
QUIC: post stream events instead of calling their handlers.
Roman Arutyunyan <arut@nginx.com>
parents:
8713
diff
changeset
|
1352 ngx_post_event(wev, &ngx_posted_events); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1353 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1354 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1355 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1356 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1357 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1358 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1359 ngx_int_t |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1360 ngx_quic_handle_max_streams_frame(ngx_connection_t *c, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1361 ngx_quic_header_t *pkt, ngx_quic_max_streams_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1362 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1363 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1364 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1365 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1366 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1367 if (f->bidi) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1368 if (qc->streams.server_max_streams_bidi < f->limit) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1369 qc->streams.server_max_streams_bidi = f->limit; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1370 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1371 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1372 "quic max_streams_bidi:%uL", f->limit); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1373 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1374 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1375 } else { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1376 if (qc->streams.server_max_streams_uni < f->limit) { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1377 qc->streams.server_max_streams_uni = f->limit; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1378 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1379 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1380 "quic max_streams_uni:%uL", f->limit); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1381 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1382 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1383 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1384 return NGX_OK; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1385 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1386 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1387 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1388 void |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1389 ngx_quic_handle_stream_ack(ngx_connection_t *c, ngx_quic_frame_t *f) |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1390 { |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1391 uint64_t sent, unacked; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1392 ngx_event_t *wev; |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1393 ngx_quic_stream_t *qs; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1394 ngx_quic_connection_t *qc; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1395 |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1396 qc = ngx_quic_get_connection(c); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1397 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1398 qs = ngx_quic_find_stream(&qc->streams.tree, f->u.stream.stream_id); |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1399 if (qs == NULL) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1400 return; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1401 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1402 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1403 wev = qs->connection->write; |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1404 sent = qs->connection->sent; |
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1405 unacked = sent - qs->acked; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1406 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8698
diff
changeset
|
1407 if (unacked >= qc->conf->stream_buffer_size && wev->active) { |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1408 wev->ready = 1; |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1409 ngx_post_event(wev, &ngx_posted_events); |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1410 } |
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1411 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1412 qs->acked += f->u.stream.length; |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1413 |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1414 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, qs->connection->log, 0, |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1415 "quic stream ack len:%uL acked:%uL unacked:%uL", |
8421
225e9f1dfe7c
QUIC: renamed stream variables from sn to qs.
Roman Arutyunyan <arut@nginx.com>
parents:
8420
diff
changeset
|
1416 f->u.stream.length, qs->acked, sent - qs->acked); |
8410
41807e581de9
QUIC: separate files for stream related processing.
Vladimir Homutov <vl@nginx.com>
parents:
diff
changeset
|
1417 } |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1418 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1419 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1420 static ngx_int_t |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1421 ngx_quic_control_flow(ngx_connection_t *c, uint64_t last) |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1422 { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1423 uint64_t len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1424 ngx_event_t *rev; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1425 ngx_quic_stream_t *qs; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1426 ngx_quic_connection_t *qc; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1427 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1428 rev = c->read; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1429 qs = c->quic; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1430 qc = ngx_quic_get_connection(qs->parent); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1431 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1432 if (last <= qs->recv_last) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1433 return NGX_OK; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1434 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1435 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1436 len = last - qs->recv_last; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1437 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1438 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1439 "quic flow control msd:%uL/%uL md:%uL/%uL", |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1440 last, qs->recv_max_data, qc->streams.recv_last + len, |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1441 qc->streams.recv_max_data); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1442 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1443 qs->recv_last += len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1444 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1445 if (!rev->error && qs->recv_last > qs->recv_max_data) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1446 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1447 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1448 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1449 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1450 qc->streams.recv_last += len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1451 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1452 if (qc->streams.recv_last > qc->streams.recv_max_data) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1453 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1454 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1455 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1456 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1457 return NGX_OK; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1458 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1459 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1460 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1461 static ngx_int_t |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1462 ngx_quic_update_flow(ngx_connection_t *c, uint64_t last) |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1463 { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1464 uint64_t len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1465 ngx_event_t *rev; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1466 ngx_connection_t *pc; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1467 ngx_quic_stream_t *qs; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1468 ngx_quic_connection_t *qc; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1469 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1470 rev = c->read; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1471 qs = c->quic; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1472 pc = qs->parent; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1473 qc = ngx_quic_get_connection(pc); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1474 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1475 if (last <= qs->recv_offset) { |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1476 return NGX_OK; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1477 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1478 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1479 len = last - qs->recv_offset; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1480 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1481 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1482 "quic flow update %uL", last); |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1483 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1484 qs->recv_offset += len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1485 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1486 if (!rev->pending_eof && !rev->error |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1487 && qs->recv_max_data <= qs->recv_offset + qs->recv_window / 2) |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1488 { |
8697
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1489 if (ngx_quic_update_max_stream_data(c) != NGX_OK) { |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1490 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1491 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1492 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1493 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1494 qc->streams.recv_offset += len; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1495 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1496 if (qc->streams.recv_max_data |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1497 <= qc->streams.recv_offset + qc->streams.recv_window / 2) |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1498 { |
8698
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1499 if (ngx_quic_update_max_data(pc) != NGX_OK) { |
8492
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1500 return NGX_ERROR; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1501 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1502 } |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1503 |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1504 return NGX_OK; |
af33d1ef1c3c
QUIC: stream flow control refactored.
Roman Arutyunyan <arut@nginx.com>
parents:
8444
diff
changeset
|
1505 } |
8617
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1506 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1507 |
8697
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1508 static ngx_int_t |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1509 ngx_quic_update_max_stream_data(ngx_connection_t *c) |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1510 { |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1511 uint64_t recv_max_data; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1512 ngx_connection_t *pc; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1513 ngx_quic_frame_t *frame; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1514 ngx_quic_stream_t *qs; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1515 ngx_quic_connection_t *qc; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1516 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1517 qs = c->quic; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1518 pc = qs->parent; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1519 qc = ngx_quic_get_connection(pc); |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1520 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1521 recv_max_data = qs->recv_offset + qs->recv_window; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1522 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1523 if (qs->recv_max_data == recv_max_data) { |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1524 return NGX_OK; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1525 } |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1526 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1527 qs->recv_max_data = recv_max_data; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1528 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1529 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1530 "quic flow update msd:%uL", qs->recv_max_data); |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1531 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1532 frame = ngx_quic_alloc_frame(pc); |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1533 if (frame == NULL) { |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1534 return NGX_ERROR; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1535 } |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1536 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1537 frame->level = ssl_encryption_application; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1538 frame->type = NGX_QUIC_FT_MAX_STREAM_DATA; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1539 frame->u.max_stream_data.id = qs->id; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1540 frame->u.max_stream_data.limit = qs->recv_max_data; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1541 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1542 ngx_quic_queue_frame(qc, frame); |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1543 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1544 return NGX_OK; |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1545 } |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1546 |
e8cbbfabe547
QUIC: update stream flow control credit on STREAM_DATA_BLOCKED.
Roman Arutyunyan <arut@nginx.com>
parents:
8695
diff
changeset
|
1547 |
8698
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1548 static ngx_int_t |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1549 ngx_quic_update_max_data(ngx_connection_t *c) |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1550 { |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1551 uint64_t recv_max_data; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1552 ngx_quic_frame_t *frame; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1553 ngx_quic_connection_t *qc; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1554 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1555 qc = ngx_quic_get_connection(c); |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1556 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1557 recv_max_data = qc->streams.recv_offset + qc->streams.recv_window; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1558 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1559 if (qc->streams.recv_max_data == recv_max_data) { |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1560 return NGX_OK; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1561 } |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1562 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1563 qc->streams.recv_max_data = recv_max_data; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1564 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1565 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1566 "quic flow update md:%uL", qc->streams.recv_max_data); |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1567 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1568 frame = ngx_quic_alloc_frame(c); |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1569 if (frame == NULL) { |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1570 return NGX_ERROR; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1571 } |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1572 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1573 frame->level = ssl_encryption_application; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1574 frame->type = NGX_QUIC_FT_MAX_DATA; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1575 frame->u.max_data.max_data = qc->streams.recv_max_data; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1576 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1577 ngx_quic_queue_frame(qc, frame); |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1578 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1579 return NGX_OK; |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1580 } |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1581 |
d041b8d6ab0b
QUIC: handle DATA_BLOCKED frame from client.
Roman Arutyunyan <arut@nginx.com>
parents:
8697
diff
changeset
|
1582 |
8617
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1583 ngx_int_t |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1584 ngx_quic_handle_read_event(ngx_event_t *rev, ngx_uint_t flags) |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1585 { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1586 if (!rev->active && !rev->ready) { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1587 rev->active = 1; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1588 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1589 } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1590 rev->active = 0; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1591 } |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1592 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1593 return NGX_OK; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1594 } |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1595 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1596 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1597 ngx_int_t |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1598 ngx_quic_handle_write_event(ngx_event_t *wev, size_t lowat) |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1599 { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1600 if (!wev->active && !wev->ready) { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1601 wev->active = 1; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1602 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1603 } else if (wev->active && wev->ready) { |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1604 wev->active = 0; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1605 } |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1606 |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1607 return NGX_OK; |
9ae239d2547d
QUIC: separate event handling functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8597
diff
changeset
|
1608 } |