From 36e9640b29f203006d7254f04758f291f4dedcd7 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Wed, 15 Feb 2023 22:18:49 +0100 Subject: DropBomb to ensure close() is called --- src/share.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/share.rs') 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 { pub(crate) udp_tx: S, pub(crate) close_tx: watch::Sender, pub(crate) tasks: Mutex>, + pub(crate) bomb: Mutex, } pub async fn new( @@ -51,6 +53,7 @@ pub async fn new( }) .collect(), tasks: Mutex::new(JoinSet::new()), + bomb: Mutex::new(DropBomb::new("rudp connection must be explicitly closed")), }); let mut tasks = share.tasks.lock().await; -- cgit v1.2.3