mirror of
https://github.com/nginx/nginx.git
synced 2024-11-24 04:49:01 +08:00
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.
This commit is contained in:
parent
77fc6b7fb9
commit
d929470685
@ -203,6 +203,9 @@ ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc)
|
||||
continue;
|
||||
}
|
||||
|
||||
sc->read->error = 1;
|
||||
sc->write->error = 1;
|
||||
|
||||
ngx_quic_set_event(sc->read);
|
||||
ngx_quic_set_event(sc->write);
|
||||
|
||||
@ -245,6 +248,10 @@ ngx_quic_do_reset_stream(ngx_quic_stream_t *qs, ngx_uint_t err)
|
||||
qs->send_state = NGX_QUIC_STREAM_SEND_RESET_SENT;
|
||||
qs->send_final_size = qs->send_offset;
|
||||
|
||||
if (qs->connection) {
|
||||
qs->connection->write->error = 1;
|
||||
}
|
||||
|
||||
pc = qs->parent;
|
||||
qc = ngx_quic_get_connection(pc);
|
||||
|
||||
@ -805,7 +812,6 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
||||
|| qs->recv_state == NGX_QUIC_STREAM_RECV_RESET_READ)
|
||||
{
|
||||
qs->recv_state = NGX_QUIC_STREAM_RECV_RESET_READ;
|
||||
rev->error = 1;
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
@ -1383,6 +1389,7 @@ ngx_int_t
|
||||
ngx_quic_handle_reset_stream_frame(ngx_connection_t *c,
|
||||
ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f)
|
||||
{
|
||||
ngx_event_t *rev;
|
||||
ngx_quic_stream_t *qs;
|
||||
ngx_quic_connection_t *qc;
|
||||
|
||||
@ -1439,7 +1446,10 @@ ngx_quic_handle_reset_stream_frame(ngx_connection_t *c,
|
||||
return ngx_quic_close_stream(qs);
|
||||
}
|
||||
|
||||
ngx_quic_set_event(qs->connection->read);
|
||||
rev = qs->connection->read;
|
||||
rev->error = 1;
|
||||
|
||||
ngx_quic_set_event(rev);
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user