Simplify RESET_STREAM reception code
@@ -6810,14 +6810,20 @@ static int conn_recv_reset_stream(ngtcp2_conn *conn,
return NGTCP2_ERR_FINAL_SIZE;
}
+ if (strm->flags & NGTCP2_STRM_FLAG_RECV_RST) {
+ return 0;
+ }
+
+ if (strm->rx.max_offset < fr->final_size) {
+ return NGTCP2_ERR_FLOW_CONTROL;
+ }
+
datalen = fr->final_size - strm->rx.last_offset;
- if (strm->rx.max_offset < fr->final_size ||
- conn_max_data_violated(conn, datalen)) {
+ if (conn_max_data_violated(conn, datalen)) {
return NGTCP2_ERR_FLOW_CONTROL;
}
- if (!(strm->flags & NGTCP2_STRM_FLAG_RECV_RST)) {
rv = conn_call_stream_reset(conn, fr->stream_id, fr->final_size,
fr->app_error_code, strm->stream_user_data);
if (rv != 0) {
@@ -6830,7 +6836,6 @@ static int conn_recv_reset_stream(ngtcp2_conn *conn,
ngtcp2_conn_extend_max_offset(conn, strm->rx.last_offset -
ngtcp2_strm_rx_offset(strm));
}
- }
conn->rx.offset += datalen;
ngtcp2_conn_extend_max_offset(conn, datalen);
