static int quic_validate_for_read(QUIC_XSO *xso, int *err, int *eos)
{
*eos = 0;
+ QUIC_STREAM_MAP *qsm;
if (xso == NULL || xso->stream == NULL) {
*err = ERR_R_INTERNAL_ERROR;
return 0;
case QUIC_RSTREAM_STATE_RESET_RECVD:
+ qsm = ossl_quic_channel_get_qsm(xso->conn->ch);
+ ossl_quic_stream_map_notify_app_read_reset_recv_part(qsm, xso->stream);
+
+ /* FALLTHROUGH */
case QUIC_RSTREAM_STATE_RESET_READ:
*err = SSL_R_STREAM_RESET;
return 0;
return QUIC_RAISE_NON_NORMAL_ERROR(ctx, err, NULL);
}
- /* If the receive part of the stream is over, issue EOF. */
- if (stream->recv_fin_retired)
- /* XXX TODO REMOVE */
- return QUIC_RAISE_NORMAL_ERROR(ctx, SSL_ERROR_ZERO_RETURN);
-
if (peek) {
if (!ossl_quic_rstream_peek(stream->rstream, buf, buf_len,
bytes_read, &is_fin))
return QUIC_RAISE_NON_NORMAL_ERROR(ctx, ERR_R_INTERNAL_ERROR, NULL);
}
- if (is_fin)
- stream->recv_fin_retired = 1;
+ if (is_fin && !peek) {
+ QUIC_STREAM_MAP *qsm = ossl_quic_channel_get_qsm(ctx->qc->ch);
+
+ ossl_quic_stream_map_notify_totally_read(qsm, ctx->xso->stream);
+ }
if (*bytes_read > 0)
ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(qc->ch),
OSSL_QUIC_FRAME_STREAM frame_data;
QUIC_STREAM *stream;
uint64_t fce;
+ size_t rs_avail;
+ int rs_fin = 0;
*datalen = 0;
frame_data.is_fin))
return 0;
+ /*
+ * rs_fin will be 1 only if we can read all data up to and including the FIN
+ * without any gaps before it; this implies we have received all data.
+ */
+ if (!ossl_quic_rstream_available(stream->rstream, &rs_avail, &rs_fin))
+ return 0;
+
+ if (rs_fin)
+ ossl_quic_stream_map_notify_totally_received(&ch->qsm, stream);
+
*datalen = frame_data.len;
return 1;