summaryrefslogtreecommitdiffstats
path: root/src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c')
-rw-r--r--src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c b/src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c
index 6bbeb8f..c00e86f 100644
--- a/src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c
+++ b/src/contrib/libngtcp2/ngtcp2/lib/ngtcp2_strm.c
@@ -158,6 +158,18 @@ void ngtcp2_strm_update_rx_offset(ngtcp2_strm *strm, uint64_t offset) {
ngtcp2_rob_remove_prefix(strm->rx.rob, offset);
}
+void ngtcp2_strm_discard_reordered_data(ngtcp2_strm *strm) {
+ if (strm->rx.rob == NULL) {
+ return;
+ }
+
+ strm->rx.cont_offset = ngtcp2_strm_rx_offset(strm);
+
+ ngtcp2_rob_free(strm->rx.rob);
+ ngtcp2_mem_free(strm->mem, strm->rx.rob);
+ strm->rx.rob = NULL;
+}
+
void ngtcp2_strm_shutdown(ngtcp2_strm *strm, uint32_t flags) {
strm->flags |= flags & NGTCP2_STRM_FLAG_SHUT_RDWR;
}
@@ -696,3 +708,25 @@ void ngtcp2_strm_set_app_error_code(ngtcp2_strm *strm,
strm->flags |= NGTCP2_STRM_FLAG_APP_ERROR_CODE_SET;
strm->app_error_code = app_error_code;
}
+
+int ngtcp2_strm_require_retransmit_reset_stream(ngtcp2_strm *strm) {
+ return !ngtcp2_strm_is_all_tx_data_fin_acked(strm);
+}
+
+int ngtcp2_strm_require_retransmit_stop_sending(ngtcp2_strm *strm) {
+ return !(strm->flags & NGTCP2_STRM_FLAG_SHUT_RD) ||
+ ngtcp2_strm_rx_offset(strm) != strm->rx.last_offset;
+}
+
+int ngtcp2_strm_require_retransmit_max_stream_data(ngtcp2_strm *strm,
+ ngtcp2_max_stream_data *fr) {
+ return fr->max_stream_data == strm->rx.max_offset &&
+ !(strm->flags &
+ (NGTCP2_STRM_FLAG_SHUT_RD | NGTCP2_STRM_FLAG_STOP_SENDING));
+}
+
+int ngtcp2_strm_require_retransmit_stream_data_blocked(
+ ngtcp2_strm *strm, ngtcp2_stream_data_blocked *fr) {
+ return fr->offset == strm->tx.max_offset &&
+ !(strm->flags & NGTCP2_STRM_FLAG_SHUT_WR);
+}