server: Reset stream if response completed before request completes
@@ -1116,6 +1116,16 @@ int Handler::remove_tx_stream_data(uint32_t stream_id, uint64_t offset,
}
}
}
+
+ if (stream->streambuf_bytes == 0 && stream->resp_state == RESP_COMPLETED) {
+ rv = ngtcp2_conn_reset_stream(conn_, stream_id, NGTCP2_INTERNAL_ERROR);
+ if (rv != 0 && rv != NGTCP2_ERR_INVALID_ARGUMENT) {
+ std::cerr << "ngtcp2_conn_reset_stream: " << ngtcp2_strerror(rv)
+ << std::endl;
+ return -1;
+ }
+ }
+
return 0;
}
