From c05b5e4292525bf02ea88816797fa551f30f7634 Mon Sep 17 00:00:00 2001 From: Felix Obenhuber Date: Mon, 23 May 2022 12:17:58 +0200 Subject: [PATCH] Remove debug stats --- mqtt-v5-broker/src/broker.rs | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/mqtt-v5-broker/src/broker.rs b/mqtt-v5-broker/src/broker.rs index cde6ba3..f3cc320 100644 --- a/mqtt-v5-broker/src/broker.rs +++ b/mqtt-v5-broker/src/broker.rs @@ -3,7 +3,7 @@ use crate::{ plugin::{AuthentificationResult, Noop, Plugin}, tree::SubscriptionTree, }; -use log::{debug, info, trace, warn}; +use log::{debug, info, warn}; use mqtt_v5::{ topic::TopicFilter, types::{ @@ -21,7 +21,7 @@ use std::{ }; use tokio::{ sync::mpsc::{self, Receiver, Sender}, - task, time, + time, }; #[derive(Debug)] @@ -193,7 +193,6 @@ pub enum WillDisconnectLogic { #[derive(Debug)] pub enum BrokerMessage { - Stats, NewClient(Box, Sender), Authenticate(String, AuthenticatePacket), Publish(String, Box), @@ -240,18 +239,6 @@ impl Broker { pub fn with_plugin(plugin: A) -> Broker { let (sender, receiver) = mpsc::channel(100); - { - let sender = sender.clone(); - task::spawn(async move { - loop { - time::sleep(time::Duration::from_secs(5)).await; - if sender.send(BrokerMessage::Stats).await.is_err() { - break; - } - } - }); - } - Broker { sessions: HashMap::new(), sender, @@ -879,15 +866,9 @@ impl Broker { } } - fn stats(&self) { - trace!("sessions: {:#?}", self.sessions); - trace!("subscriptions: {:#?}", self.subscriptions); - } - pub async fn run(mut self) { while let Some(msg) = self.receiver.recv().await { match msg { - BrokerMessage::Stats => self.stats(), BrokerMessage::NewClient(connect_packet, client_msg_sender) => { self.handle_new_client(*connect_packet, client_msg_sender).await; },