return NGX_ERROR;
}
- stream->out_closed = 1;
+ stream->rst_sent = 1;
fc = stream->request->connection;
fc->error = 1;
return;
}
- if (!stream->out_closed) {
- if (ngx_http_v2_send_rst_stream(h2c, node->id,
- fc->timedout ? NGX_HTTP_V2_PROTOCOL_ERROR
- : NGX_HTTP_V2_INTERNAL_ERROR)
- != NGX_OK)
- {
- h2c->connection->error = 1;
+ if (!stream->rst_sent && !h2c->connection->error) {
+
+ if (!stream->out_closed) {
+ if (ngx_http_v2_send_rst_stream(h2c, node->id,
+ fc->timedout ? NGX_HTTP_V2_PROTOCOL_ERROR
+ : NGX_HTTP_V2_INTERNAL_ERROR)
+ != NGX_OK)
+ {
+ h2c->connection->error = 1;
+ }
+
+ } else if (!stream->in_closed) {
+ if (ngx_http_v2_send_rst_stream(h2c, node->id, NGX_HTTP_V2_NO_ERROR)
+ != NGX_OK)
+ {
+ h2c->connection->error = 1;
+ }
}
}
c = h2c->connection;
- if (h2c->state.stream) {
- h2c->state.stream->out_closed = 1;
- ngx_http_v2_close_stream(h2c->state.stream, NGX_HTTP_BAD_REQUEST);
- }
-
h2c->blocked = 1;
if (!c->error && ngx_http_v2_send_goaway(h2c, status) != NGX_ERROR) {
(void) ngx_http_v2_send_output_queue(h2c);
}
+ c->error = 1;
+
+ if (h2c->state.stream) {
+ ngx_http_v2_close_stream(h2c->state.stream, NGX_HTTP_BAD_REQUEST);
+ }
+
if (!h2c->processing) {
ngx_http_close_connection(c);
return;
}
- c->error = 1;
c->read->handler = ngx_http_empty_handler;
c->write->handler = ngx_http_empty_handler;