unsigned int deleted : 1;
};
-/*
- * Marks a stream for STOP_SENDING. aec is the application error code (AEC).
- * This can only fail if it has already been called.
- */
-int ossl_quic_stream_stop_sending(QUIC_STREAM *s, uint64_t aec);
-
-/*
- * Marks a stream for reset. aec is the application error code (AEC).
- * This can only fail if it has already been called.
- */
-int ossl_quic_stream_reset(QUIC_STREAM *s, uint64_t aec);
-
/*
* QUIC Stream Map
* ===============
/*
* Resets the sending part of a stream.
+ *
+ * Returns 1 if the sending part of a stream was not already reset.
+ * Returns 0 otherwise, which need not be considered an error.
+ */
+int ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *qs,
+ uint64_t aec);
+
+/*
+ * Marks the receiving part of a stream for STOP_SENDING.
+ *
+ * Returns 1 if the receiving part of a stream was not already marked for
+ * STOP_SENDING.
+ * Returns 0 otherwise, which need not be considered an error.
*/
-void ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
- QUIC_STREAM *qs,
- uint64_t aec);
+int ossl_quic_stream_map_stop_sending_recv_part(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *qs,
+ uint64_t aec);
/*
* Adds a stream to the accept queue.
void ossl_quic_channel_reject_stream(QUIC_CHANNEL *ch, QUIC_STREAM *qs)
{
- ossl_quic_stream_stop_sending(qs, ch->incoming_stream_auto_reject_aec);
- ossl_quic_stream_reset(qs, ch->incoming_stream_auto_reject_aec);
+ ossl_quic_stream_map_stop_sending_recv_part(&ch->qsm, qs,
+ ch->incoming_stream_auto_reject_aec);
+ ossl_quic_stream_map_reset_stream_send_part(&ch->qsm, qs,
+ ch->incoming_stream_auto_reject_aec);
qs->deleted = 1;
ossl_quic_stream_map_update_state(&ch->qsm, qs);
#include "internal/quic_stream_map.h"
#include "internal/nelem.h"
-/* QUIC Stream
- * ===========
- */
-
-int ossl_quic_stream_stop_sending(QUIC_STREAM *s, uint64_t aec)
-{
- if (s->stop_sending)
- return 0;
-
- s->stop_sending_aec = aec;
- s->stop_sending = 1;
- s->want_stop_sending = 1;
- return 1;
-}
-
-int ossl_quic_stream_reset(QUIC_STREAM *s, uint64_t aec)
-{
- if (s->reset_stream)
- return 0;
-
- s->reset_stream_aec = aec;
- s->reset_stream = 1;
- s->want_reset_stream = 1;
- return 1;
-}
-
/*
* QUIC Stream Map
* ===============
stream_map_mark_inactive(qsm, s);
}
-void ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
- QUIC_STREAM *qs,
- uint64_t aec)
+int ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *qs,
+ uint64_t aec)
{
if (qs->reset_stream)
- return;
+ return 0;
qs->reset_stream = 1;
qs->reset_stream_aec = aec;
qs->want_reset_stream = 1;
ossl_quic_stream_map_update_state(qsm, qs);
+ return 1;
+}
+
+int ossl_quic_stream_map_stop_sending_recv_part(QUIC_STREAM_MAP *qsm,
+ QUIC_STREAM *qs,
+ uint64_t aec)
+{
+ if (qs->stop_sending)
+ return 0;
+
+ qs->stop_sending = 1;
+ qs->stop_sending_aec = aec;
+ qs->want_stop_sending = 1;
+
+ ossl_quic_stream_map_update_state(qsm, qs);
+ return 1;
}
QUIC_STREAM *ossl_quic_stream_map_peek_accept_queue(QUIC_STREAM_MAP *qsm)
op->arg0)))
goto err;
- if (!TEST_true(ossl_quic_stream_stop_sending(s, op->arg1)))
+ if (!TEST_true(ossl_quic_stream_map_stop_sending_recv_part(h.args.qsm,
+ s, op->arg1)))
goto err;
ossl_quic_stream_map_update_state(h.args.qsm, s);
op->arg0)))
goto err;
- if (!TEST_true(ossl_quic_stream_reset(s, op->arg1)))
+ if (!TEST_true(ossl_quic_stream_map_reset_stream_send_part(h.args.qsm,
+ s, op->arg1)))
goto err;
ossl_quic_stream_map_update_state(h.args.qsm, s);