mirror of https://github.com/openssl/openssl.git
QUIC QSM: Clean up SEND_STREAM/RECV_STREAM handling
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20765)
This commit is contained in:
parent
723cbe8a73
commit
e8b9f63235
|
|
@ -107,18 +107,6 @@ struct quic_stream_st {
|
||||||
unsigned int deleted : 1;
|
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
|
* QUIC Stream Map
|
||||||
* ===============
|
* ===============
|
||||||
|
|
@ -239,10 +227,24 @@ void ossl_quic_stream_map_set_rr_stepping(QUIC_STREAM_MAP *qsm, size_t stepping)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resets the sending part of a stream.
|
* 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.
|
||||||
*/
|
*/
|
||||||
void ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
|
int ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
|
||||||
QUIC_STREAM *qs,
|
QUIC_STREAM *qs,
|
||||||
uint64_t aec);
|
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.
|
||||||
|
*/
|
||||||
|
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.
|
* Adds a stream to the accept queue.
|
||||||
|
|
|
||||||
|
|
@ -2380,9 +2380,11 @@ void ossl_quic_channel_set_incoming_stream_auto_reject(QUIC_CHANNEL *ch,
|
||||||
|
|
||||||
void ossl_quic_channel_reject_stream(QUIC_CHANNEL *ch, QUIC_STREAM *qs)
|
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_map_stop_sending_recv_part(&ch->qsm, qs,
|
||||||
ossl_quic_stream_reset(qs, ch->incoming_stream_auto_reject_aec);
|
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;
|
qs->deleted = 1;
|
||||||
|
|
||||||
ossl_quic_stream_map_update_state(&ch->qsm, qs);
|
ossl_quic_stream_map_update_state(&ch->qsm, qs);
|
||||||
|
|
|
||||||
|
|
@ -10,32 +10,6 @@
|
||||||
#include "internal/quic_stream_map.h"
|
#include "internal/quic_stream_map.h"
|
||||||
#include "internal/nelem.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
|
* QUIC Stream Map
|
||||||
* ===============
|
* ===============
|
||||||
|
|
@ -284,18 +258,34 @@ void ossl_quic_stream_map_update_state(QUIC_STREAM_MAP *qsm, QUIC_STREAM *s)
|
||||||
stream_map_mark_inactive(qsm, s);
|
stream_map_mark_inactive(qsm, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
|
int ossl_quic_stream_map_reset_stream_send_part(QUIC_STREAM_MAP *qsm,
|
||||||
QUIC_STREAM *qs,
|
QUIC_STREAM *qs,
|
||||||
uint64_t aec)
|
uint64_t aec)
|
||||||
{
|
{
|
||||||
if (qs->reset_stream)
|
if (qs->reset_stream)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
qs->reset_stream = 1;
|
qs->reset_stream = 1;
|
||||||
qs->reset_stream_aec = aec;
|
qs->reset_stream_aec = aec;
|
||||||
qs->want_reset_stream = 1;
|
qs->want_reset_stream = 1;
|
||||||
|
|
||||||
ossl_quic_stream_map_update_state(qsm, qs);
|
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)
|
QUIC_STREAM *ossl_quic_stream_map_peek_accept_queue(QUIC_STREAM_MAP *qsm)
|
||||||
|
|
|
||||||
|
|
@ -1470,7 +1470,8 @@ static int run_script(const struct script_op *script)
|
||||||
op->arg0)))
|
op->arg0)))
|
||||||
goto err;
|
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;
|
goto err;
|
||||||
|
|
||||||
ossl_quic_stream_map_update_state(h.args.qsm, s);
|
ossl_quic_stream_map_update_state(h.args.qsm, s);
|
||||||
|
|
@ -1487,7 +1488,8 @@ static int run_script(const struct script_op *script)
|
||||||
op->arg0)))
|
op->arg0)))
|
||||||
goto err;
|
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;
|
goto err;
|
||||||
|
|
||||||
ossl_quic_stream_map_update_state(h.args.qsm, s);
|
ossl_quic_stream_map_update_state(h.args.qsm, s);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue