MINOR: mux-quic: support MAX_STREAM_DATA frame parsing

Implement a MUX method to parse MAX_STREAM_DATA. If the limit is greater
than the previous one and the stream was blocked, the flag
QC_SF_BLK_SFCTL is removed.
This commit is contained in:
Amaury Denoyelle 2022-03-08 10:39:55 +01:00
parent 05ce55e582
commit 8727ff4668
3 changed files with 33 additions and 0 deletions

View File

@ -22,6 +22,7 @@ void qcs_notify_send(struct qcs *qcs);
int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
char fin, char *data, struct qcs **out_qcs);
int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max);
int qcc_decode_qcs(struct qcc *qcc, struct qcs *qcs);
void qcc_streams_sent_done(struct qcs *qcs, uint64_t data, uint64_t offset);

View File

@ -253,6 +253,32 @@ int qcc_recv(struct qcc *qcc, uint64_t id, uint64_t len, uint64_t offset,
return 0;
}
/* Handle a new MAX_STREAM_DATA frame. <max> must contains the maximum data
* field of the frame and <id> is the identifier of the QUIC stream.
*
* Returns 0 on success else non-zero.
*/
int qcc_recv_max_stream_data(struct qcc *qcc, uint64_t id, uint64_t max)
{
struct qcs *qcs;
struct eb64_node *node;
node = eb64_lookup(&qcc->streams_by_id, id);
if (node) {
qcs = eb64_entry(&node->node, struct qcs, by_id);
if (max > qcs->tx.msd) {
qcs->tx.msd = max;
if (qcs->flags & QC_SF_BLK_SFCTL) {
qcs->flags &= ~QC_SF_BLK_SFCTL;
tasklet_wakeup(qcc->wait_event.tasklet);
}
}
}
return 0;
}
/* Decode the content of STREAM frames already received on the stream instance
* <qcs>.
*

View File

@ -2456,6 +2456,12 @@ static int qc_parse_pkt_frms(struct quic_rx_packet *pkt, struct ssl_sock_ctx *ct
}
case QUIC_FT_MAX_DATA:
case QUIC_FT_MAX_STREAM_DATA:
if (qc->mux_state == QC_MUX_READY) {
struct quic_max_stream_data *data = &frm.max_stream_data;
qcc_recv_max_stream_data(qc->qcc, data->id,
data->max_stream_data);
}
break;
case QUIC_FT_MAX_STREAMS_BIDI:
case QUIC_FT_MAX_STREAMS_UNI:
case QUIC_FT_DATA_BLOCKED: