Skip to content

Commit

Permalink
fix(s2n-quic-dc): replace generational-areana with slotmap (#2243)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Jun 11, 2024
1 parent 75e60fc commit c93f74a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 7 additions & 3 deletions dc/s2n-quic-dc/src/stream/send/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -37,6 +36,7 @@ use s2n_quic_core::{
},
varint::VarInt,
};
use slotmap::SlotMap;
use std::collections::{BinaryHeap, VecDeque};
use tracing::{debug, trace};

Expand All @@ -48,6 +48,10 @@ type PacketMap<Info> = s2n_quic_core::packet::number::Map<Info>;

pub type Transmission = application::transmission::Event<buffer::Segment>;

slotmap::new_key_type! {
pub struct BufferIndex;
}

#[derive(Clone, Copy, Debug)]
pub enum TransmitIndex {
Stream(BufferIndex),
Expand All @@ -72,10 +76,10 @@ pub struct Worker {
pub stream_id: stream::Id,
pub rtt_estimator: RttEstimator,
pub sent_stream_packets: PacketMap<SentStreamPacket>,
pub stream_packet_buffers: Arena<buffer::Segment>,
pub stream_packet_buffers: SlotMap<BufferIndex, buffer::Segment>,
pub max_stream_packet_number: VarInt,
pub sent_recovery_packets: PacketMap<SentRecoveryPacket>,
pub recovery_packet_buffers: Arena<Vec<u8>>,
pub recovery_packet_buffers: SlotMap<BufferIndex, Vec<u8>>,
pub free_packet_buffers: Vec<Vec<u8>>,
pub recovery_packet_number: u64,
pub last_sent_recovery_packet: Option<Timestamp>,
Expand Down

0 comments on commit c93f74a

Please sign in to comment.