aboutsummaryrefslogtreecommitdiff
path: root/src/recv.rs
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 21:54:25 +0100
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 21:55:47 +0100
commit1d4ebed25ff3e05d2fac70a040901fd3ea3029eb (patch)
treee4d8d52177ffd907064a6dc19d61bd3aa482ffcd /src/recv.rs
parent45d7cd0049b9349de428945c4a7c9b73cb0f461d (diff)
downloadmt_rudp-1d4ebed25ff3e05d2fac70a040901fd3ea3029eb.tar.xz
Rework structure
Diffstat (limited to 'src/recv.rs')
-rw-r--r--src/recv.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/recv.rs b/src/recv.rs
index a88426f..572b17e 100644
--- a/src/recv.rs
+++ b/src/recv.rs
@@ -1,4 +1,4 @@
-use crate::{prelude::*, ticker, RecvChan, RecvWorker, RudpShare, Split};
+use super::*;
use async_recursion::async_recursion;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::{
@@ -17,6 +17,28 @@ fn to_seqnum(seqnum: u16) -> usize {
type Result<T> = std::result::Result<T, Error>;
+#[derive(Debug)]
+struct Split {
+ timestamp: Option<Instant>,
+ chunks: Vec<OnceCell<Vec<u8>>>,
+ got: usize,
+}
+
+struct RecvChan {
+ packets: Vec<Option<Vec<u8>>>, // char ** 😛
+ splits: HashMap<u16, Split>,
+ seqnum: u16,
+ num: u8,
+}
+
+pub(crate) struct RecvWorker<R: UdpReceiver, S: UdpSender> {
+ share: Arc<RudpShare<S>>,
+ close: watch::Receiver<bool>,
+ chans: Arc<Vec<Mutex<RecvChan>>>,
+ pkt_tx: mpsc::UnboundedSender<InPkt>,
+ udp_rx: R,
+}
+
impl<R: UdpReceiver, S: UdpSender> RecvWorker<R, S> {
pub fn new(
udp_rx: R,