Skip to content

Commit

Permalink
Remove debug stats
Browse files Browse the repository at this point in the history
  • Loading branch information
flxo committed May 23, 2022
1 parent 520f9e2 commit e9d975e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
23 changes: 2 additions & 21 deletions mqtt-v5-broker/src/broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -21,7 +21,7 @@ use std::{
};
use tokio::{
sync::mpsc::{self, Receiver, Sender},
task, time,
time,
};

#[derive(Debug)]
Expand Down Expand Up @@ -193,7 +193,6 @@ pub enum WillDisconnectLogic {

#[derive(Debug)]
pub enum BrokerMessage {
Stats,
NewClient(Box<ConnectPacket>, Sender<ClientMessage>),
Authenticate(String, AuthenticatePacket),
Publish(String, Box<PublishPacket>),
Expand Down Expand Up @@ -240,18 +239,6 @@ impl<A: Plugin> Broker<A> {
pub fn with_plugin(plugin: A) -> Broker<A> {
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,
Expand Down Expand Up @@ -879,15 +866,9 @@ impl<A: Plugin> Broker<A> {
}
}

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;
},
Expand Down
1 change: 0 additions & 1 deletion mqtt-v5-broker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit e9d975e

Please sign in to comment.