aboutsummaryrefslogtreecommitdiff
path: root/src/share.rs
diff options
context:
space:
mode:
authorLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 22:18:49 +0100
committerLizzy Fleckenstein <eliasfleckenstein@web.de>2023-02-15 22:18:49 +0100
commit36e9640b29f203006d7254f04758f291f4dedcd7 (patch)
tree6ace65819ad1dfcdf21e594d205d846a4511f60a /src/share.rs
parent9498c45d1291c0b2343339bad624d0dc0ca0a934 (diff)
downloadmt_rudp-36e9640b29f203006d7254f04758f291f4dedcd7.tar.xz
DropBomb to ensure close() is called
Diffstat (limited to 'src/share.rs')
-rw-r--r--src/share.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/share.rs b/src/share.rs
index ad63290..a2afc4c 100644
--- a/src/share.rs
+++ b/src/share.rs
@@ -1,4 +1,5 @@
use super::*;
+use drop_bomb::DropBomb;
use std::{borrow::Cow, collections::HashMap, io, sync::Arc, time::Duration};
use tokio::{
sync::{mpsc, watch, Mutex, RwLock},
@@ -26,6 +27,7 @@ pub(crate) struct RudpShare<S: UdpSender> {
pub(crate) udp_tx: S,
pub(crate) close_tx: watch::Sender<bool>,
pub(crate) tasks: Mutex<JoinSet<()>>,
+ pub(crate) bomb: Mutex<DropBomb>,
}
pub async fn new<S: UdpSender, R: UdpReceiver>(
@@ -51,6 +53,7 @@ pub async fn new<S: UdpSender, R: UdpReceiver>(
})
.collect(),
tasks: Mutex::new(JoinSet::new()),
+ bomb: Mutex::new(DropBomb::new("rudp connection must be explicitly closed")),
});
let mut tasks = share.tasks.lock().await;