QUIC_NEEDS_LOCK
static int quic_validate_for_read(QUIC_XSO *xso, int *err, int *eos)
{
- *eos = 0;
QUIC_STREAM_MAP *qsm;
+ *eos = 0;
+
if (xso == NULL || xso->stream == NULL) {
*err = ERR_R_INTERNAL_ERROR;
return 0;
} else if (ossl_quic_channel_is_term_any(qc->ch)) {
/* Connection already closed. */
*state = SSL_STREAM_STATE_CONN_CLOSED;
- } else if (!is_write && qs->recv_fin_retired) {
+ } else if (!is_write && qs->recv_state == QUIC_RSTREAM_STATE_DATA_READ) {
/* Application has read a FIN. */
*state = SSL_STREAM_STATE_FINISHED;
} else if ((!is_write && qs->stop_sending)
return 1;
}
- if (qs->recv_fin_retired || !ossl_quic_stream_has_recv_buffer(qs))
+ if (qs->recv_state == QUIC_RSTREAM_STATE_DATA_READ
+ || !ossl_quic_stream_has_recv_buffer(qs))
return 0;
if (!ossl_quic_rstream_read(qs->rstream, buf, buf_len,
}
if (is_fin)
- qs->recv_fin_retired = 1;
+ ossl_quic_stream_map_notify_totally_read(ossl_quic_channel_get_qsm(srv->ch),
+ qs);
if (*bytes_read > 0)
ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(srv->ch), qs);
qs = ossl_quic_stream_map_get_by_id(ossl_quic_channel_get_qsm(srv->ch),
stream_id);
- if (qs == NULL || !ossl_quic_stream_has_recv_buffer(qs))
+ if (qs == NULL)
return 0;
- if (qs->recv_fin_retired)
+ if (qs->recv_state == QUIC_RSTREAM_STATE_DATA_READ)
return 1;
+ if (!ossl_quic_stream_has_recv_buffer(qs))
+ return 0;
+
/*
- * If we do not have recv_fin_retired, it is possible we should still return
- * 1 if there is a lone FIN (but no more data) remaining to be retired from
+ * If we do not have the DATA_READ, it is possible we should still return 1
+ * if there is a lone FIN (but no more data) remaining to be retired from
* the RSTREAM, for example because ossl_quic_tserver_read() has not been
* called since the FIN was received.
*/
ossl_quic_rstream_read(qs->rstream, buf, sizeof(buf),
&bytes_read, &is_fin); /* best effort */
assert(is_fin && bytes_read == 0);
+ assert(qs->recv_state == QUIC_RSTREAM_STATE_DATA_RECVD);
- qs->recv_fin_retired = 1;
+ ossl_quic_stream_map_notify_totally_read(ossl_quic_channel_get_qsm(srv->ch),
+ qs);
ossl_quic_stream_map_update_state(ossl_quic_channel_get_qsm(srv->ch), qs);
return 1;
}