Skip to content

Commit

Permalink
Log mqtt recv errors as WARN level
Browse files Browse the repository at this point in the history
  • Loading branch information
akiroz committed Jan 25, 2024
1 parent 9e249f6 commit e5fab39
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zika"
version = "3.3.2"
version = "3.3.3"
license = "MIT"
description = "IP Tunneling over MQTT"
repository = "https://github.com/akiroz/zika"
Expand Down
3 changes: 2 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ impl Client {
return;
}
}
log::warn!("drop packet: unknown addr {:?}", &dest);
// Stray packets sent to interface
log::debug!("drop packet: unknown addr {:?}", &dest);
}

// mqtt -> tun
Expand Down
20 changes: 13 additions & 7 deletions src/remote.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use core::time::Duration;
use std::sync::Arc;
use std::ops::Range;

use log;
use bytes::Bytes;
use tokio::{sync::{mpsc, Mutex}, task};
use rumqttc::v5::{
self as mqtt,
mqttbytes::{v5::Packet, QoS},
mqttbytes::{v5::Packet, QoS, v5::PublishProperties},
};
use std::sync::Arc;
use tokio::{sync::{mpsc, Mutex}, task};

use crate::lookup_pool::LookupPool;
use rumqttc::v5::mqttbytes::v5::PublishProperties;
use std::ops::Range;

// Context for receiving messsage from remote
struct RemoteIncomingContext {
Expand Down Expand Up @@ -68,8 +69,13 @@ impl Remote {
log::trace!("broker[{}] recv {:?}", idx, pkt);
Self::handle_packet(&mut context, pkt).await;
}
x => {
log::trace!("broker[{}] recv {:?}", idx, x);
Err(err) => {
log::warn!("broker[{}] recv {:?}", idx, err);
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
}
Ok(msg) => { // Other messages
log::trace!("broker[{}] recv {:?}", idx, msg);
continue;
}
};
Expand Down

0 comments on commit e5fab39

Please sign in to comment.