use async_trait::async_trait;
use num_enum::TryFromPrimitive;
-use std::{
- cell::{Cell, OnceCell},
- collections::HashMap,
- io, ops,
- sync::Arc,
- time::Instant,
-};
+use std::{cell::OnceCell, collections::HashMap, io, ops, sync::Arc, time::Instant};
use tokio::{
sync::{mpsc, watch, Mutex, RwLock},
task::JoinSet,
}
struct RecvChan {
- packets: Vec<Cell<Option<Vec<u8>>>>, // char ** 😛
+ packets: Vec<Option<Vec<u8>>>, // char ** 😛
splits: HashMap<u16, Split>,
seqnum: u16,
num: u8,
use async_recursion::async_recursion;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::{
- cell::{Cell, OnceCell},
+ cell::OnceCell,
collections::HashMap,
io,
pin::Pin,
.map(|num| {
Mutex::new(RecvChan {
num,
- packets: (0..REL_BUFFER).map(|_| Cell::new(None)).collect(),
+ packets: (0..REL_BUFFER).map(|_| None).collect(),
seqnum: INIT_SEQNUM,
splits: HashMap::new(),
})
println!("Rel");
let seqnum = cursor.read_u16::<BigEndian>()?;
- chan.packets[to_seqnum(seqnum)].set(Some(cursor.remaining_slice().into()));
+ chan.packets[to_seqnum(seqnum)].replace(cursor.remaining_slice().into());
let mut ack_data = Vec::with_capacity(3);
ack_data.write_u8(CtlType::Ack as u8)?;