diff --git a/dc/s2n-quic-dc/Cargo.toml b/dc/s2n-quic-dc/Cargo.toml index 8c69596b7..74a0eee45 100644 --- a/dc/s2n-quic-dc/Cargo.toml +++ b/dc/s2n-quic-dc/Cargo.toml @@ -21,13 +21,13 @@ bolero-generator = { version = "0.11", optional = true } bytes = "1" crossbeam-channel = "0.5" crossbeam-queue = { version = "0.3" } -generational-arena = { version = "0.2" } libc = "0.2" num-rational = { version = "0.4", default-features = false } once_cell = "1" s2n-codec = { version = "=0.38.1", path = "../../common/s2n-codec", default-features = false } s2n-quic-core = { version = "=0.38.1", path = "../../quic/s2n-quic-core", default-features = false } s2n-quic-platform = { version = "=0.38.1", path = "../../quic/s2n-quic-platform" } +slotmap = "1" thiserror = "1" tokio = { version = "1", features = ["io-util"], optional = true } tracing = "0.1" diff --git a/dc/s2n-quic-dc/src/stream/send/worker.rs b/dc/s2n-quic-dc/src/stream/send/worker.rs index f1033d848..80213b493 100644 --- a/dc/s2n-quic-dc/src/stream/send/worker.rs +++ b/dc/s2n-quic-dc/src/stream/send/worker.rs @@ -19,7 +19,6 @@ use crate::{ }, }; use core::{task::Poll, time::Duration}; -use generational_arena::{Arena, Index as BufferIndex}; use s2n_codec::{DecoderBufferMut, EncoderBuffer}; use s2n_quic_core::{ ensure, @@ -37,6 +36,7 @@ use s2n_quic_core::{ }, varint::VarInt, }; +use slotmap::SlotMap; use std::collections::{BinaryHeap, VecDeque}; use tracing::{debug, trace}; @@ -48,6 +48,10 @@ type PacketMap = s2n_quic_core::packet::number::Map; pub type Transmission = application::transmission::Event; +slotmap::new_key_type! { + pub struct BufferIndex; +} + #[derive(Clone, Copy, Debug)] pub enum TransmitIndex { Stream(BufferIndex), @@ -72,10 +76,10 @@ pub struct Worker { pub stream_id: stream::Id, pub rtt_estimator: RttEstimator, pub sent_stream_packets: PacketMap, - pub stream_packet_buffers: Arena, + pub stream_packet_buffers: SlotMap, pub max_stream_packet_number: VarInt, pub sent_recovery_packets: PacketMap, - pub recovery_packet_buffers: Arena>, + pub recovery_packet_buffers: SlotMap>, pub free_packet_buffers: Vec>, pub recovery_packet_number: u64, pub last_sent_recovery_packet: Option,