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; }, diff --git a/mqtt-v5-broker/src/main.rs b/mqtt-v5-broker/src/main.rs index 6c73a8f..42a9561 100644 --- a/mqtt-v5-broker/src/main.rs +++ b/mqtt-v5-broker/src/main.rs @@ -5,7 +5,6 @@ use log::{debug, info}; use mqtt_v5_broker::{ broker::{Broker, BrokerMessage}, client, - plugin::Noop, }; use tokio::{net::TcpListener, sync::mpsc::Sender, task};