pub async fn clear(&mut self, local: bool) {
        if local {
            let local_addrs = self.local_addrs.read().await;
            for a in local_addrs.iter() {
                if let Some(mset) = self.pending.read().await.get(&a) {
                    for m in mset.msgs.values() {
                        if !self.local_msgs.write().await.remove(&m) {
                            warn!("error deleting local message");
                        }
                    }
                }
            }
            self.pending.write().await.clear();
            self.republished.write().await.clear();
        } else {
            let mut pending = self.pending.write().await;
            let local_addrs = self.local_addrs.read().await;
            pending.retain(|a, _| local_addrs.contains(&a));
        }
    }
/// If `local = true`, the local messages will be removed as well as pending messages.
/// If `local = false`, pending messages will be removed while retaining local messages.
If `local = true`, the local messages will be removed as well as pending messages.
If `local = false`, pending messages will be removed while retaining local messages.
If ` local = true ` the local messages will be removed as well as pending messages . If ` local = false ` pending messages will be removed while retaining local messages .
pub async fn clear(&mut self, local: bool) {
        if local {
            let local_addrs = self.local_addrs.read().await;
            for a in local_addrs.iter() {
                if let Some(mset) = self.pending.read().await.get(&a) {
                    for m in mset.msgs.values() {
                        if !self.local_msgs.write().await.remove(&m) {
                            warn!("error deleting local message");
                        }
                    }
                }
            }
            self.pending.write().await.clear();
            self.republished.write().await.clear();
        } else {
            let mut pending = self.pending.write().await;
            let local_addrs = self.local_addrs.read().await;
            pending.retain(|a, _| local_addrs.contains(&a));
        }
    }
pub async fn clear ( & mut self , local : bool ) { if local { let local_addrs = self . local_addrs . read ( ) . await ; for a in local_addrs . iter ( ) { if let Some ( mset ) = self . pending . read ( ) . await . get ( & a ) { for m in mset . msgs . values ( ) { if ! self . local_msgs . write ( ) . await . remove ( & m ) { warn ! ( " " ) ; } } } } self . pending . write ( ) . await . clear ( ) ; self . republished . write ( ) . await . clear ( ) ; } else { let mut pending = self . pending . write ( ) . await ; let local_addrs = self . local_addrs . read ( ) . await ; pending . retain ( | a , _ | local_addrs . contains ( & a ) ) ; } }
If `local = true`, the local messages will be removed as well as pending messages.
If ` local = true ` the local messages will be removed as well as pending messages .
&mut self
local
bool