Mercurial > hg > nginx
annotate src/event/ngx_event_posted.c @ 9065:2ee6f9729739 quic
QUIC: set stream error flag on reset.
Now, when RESET_STREAM is sent or received, or when streams are closed,
stream connection error flag is set. Previously, only stream state was
changed, which resulted in setting the error flag only after calling
recv()/send()/send_chain(). However, there are cases when none of these
functions is called, but it's still important to know if the stream is being
closed. For example, when an HTTP/3 request stream is blocked on insert count,
receiving RESET_STREAM should trigger stream closure, which was not the case.
The change also fixes ngx_http_upstream_check_broken_connection() and
ngx_http_test_reading() with QUIC streams.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 10 Jan 2023 17:42:40 +0400 |
parents | f1720934c45b |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
381
diff
changeset
|
6 |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 #include <ngx_event.h> |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
13 ngx_queue_t ngx_posted_accept_events; |
7584
9d2ad2fb4423
SSL: available bytes handling (ticket #1431).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5821
diff
changeset
|
14 ngx_queue_t ngx_posted_next_events; |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
15 ngx_queue_t ngx_posted_events; |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 |
563 | 18 void |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
19 ngx_event_process_posted(ngx_cycle_t *cycle, ngx_queue_t *posted) |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 { |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
21 ngx_queue_t *q; |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 ngx_event_t *ev; |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
24 while (!ngx_queue_empty(posted)) { |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 |
5821
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
26 q = ngx_queue_head(posted); |
3f5f0ab59b35
Events: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev <vbart@nginx.com>
parents:
5820
diff
changeset
|
27 ev = ngx_queue_data(q, ngx_event_t, queue); |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
461 | 30 "posted event %p", ev); |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 |
375
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
32 ngx_delete_posted_event(ev); |
744ccb59062d
nginx-0.0.7-2004-07-02-19:54:34 import
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
33 |
509 | 34 ev->handler(ev); |
306
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 } |
6b91bfbc4123
nginx-0.0.3-2004-04-05-00:32:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 } |
7612
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
37 |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
38 |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
39 void |
7617
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
40 ngx_event_move_posted_next(ngx_cycle_t *cycle) |
7612
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
41 { |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
42 ngx_queue_t *q; |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
43 ngx_event_t *ev; |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
44 |
7617
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
45 for (q = ngx_queue_head(&ngx_posted_next_events); |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
46 q != ngx_queue_sentinel(&ngx_posted_next_events); |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
47 q = ngx_queue_next(q)) |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
48 { |
7612
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
49 ev = ngx_queue_data(q, ngx_event_t, queue); |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
50 |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
51 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
52 "posted next event %p", ev); |
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
53 |
7617
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
54 ev->ready = 1; |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
55 ev->available = -1; |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
56 } |
7612
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
57 |
7617
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
58 ngx_queue_add(&ngx_posted_events, &ngx_posted_next_events); |
f1720934c45b
SSL: reworked posted next events again.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7612
diff
changeset
|
59 ngx_queue_init(&ngx_posted_next_events); |
7612
1ce3f01a4355
SSL: reworked posted next events.
Maxim Dounin <mdounin@mdounin.ru>
parents:
7584
diff
changeset
|
60 } |