summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2024-04-05 11:39:05 +0200
committerMatthias Beyer <mail@beyermatthias.de>2024-04-05 11:44:44 +0200
commitcb21213d2167f9dab759ea0d6ecddd8d4ef5262d (patch)
treec316ab04d1a28c236524d87371002018338ff592
parent26166f09aafd5f5828f18722c007f19724d8d254 (diff)
Clearify name: We only ack QoS1 packets
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--cloudmqtt-bin/src/bin/client.rs2
-rw-r--r--src/client/builder.rs6
-rw-r--r--src/client/send.rs10
3 files changed, 9 insertions, 9 deletions
diff --git a/cloudmqtt-bin/src/bin/client.rs b/cloudmqtt-bin/src/bin/client.rs
index 0c8ebf0..8b044fe 100644
--- a/cloudmqtt-bin/src/bin/client.rs
+++ b/cloudmqtt-bin/src/bin/client.rs
@@ -57,7 +57,7 @@ async fn main() {
.with_on_packet_recv(Box::new(|packet| {
tracing::trace!(?packet, "Received packet")
}))
- .with_handle_acknowledge(Box::new(|packet| {
+ .with_handle_qos1_acknowledge(Box::new(|packet| {
async move {
tracing::trace!(?packet, "Acknowledging packet");
cloudmqtt::client::send::Acknowledge::Yes
diff --git a/src/client/builder.rs b/src/client/builder.rs
index e981e2e..e8629eb 100644
--- a/src/client/builder.rs
+++ b/src/client/builder.rs
@@ -10,7 +10,7 @@ use futures::lock::Mutex;
use super::send::Callbacks;
use super::send::ClientHandlers;
-use super::send::HandleAcknowledgeFn;
+use super::send::HandleQos1AcknowledgeFn;
use super::send::OnPacketRecvFn;
use super::InnerClient;
use super::MqttClient;
@@ -31,8 +31,8 @@ impl MqttClientBuilder {
self
}
- pub fn with_handle_acknowledge(mut self, f: HandleAcknowledgeFn) -> Self {
- self.handlers.handle_acknowledge = f;
+ pub fn with_handle_qos1_acknowledge(mut self, f: HandleQos1AcknowledgeFn) -> Self {
+ self.handlers.handle_qos1_acknowledge = f;
self
}
diff --git a/src/client/send.rs b/src/client/send.rs
index 319412b..161e130 100644
--- a/src/client/send.rs
+++ b/src/client/send.rs
@@ -215,13 +215,13 @@ pub struct PacketIdentifierExhausted;
pub(crate) struct ClientHandlers {
pub(crate) on_packet_recv: OnPacketRecvFn,
- pub(crate) handle_acknowledge: HandleAcknowledgeFn,
- // on_receive: Box<dyn Fn(&crate::packets::MqttPacket) + Send>,
- // on_complete: Box<dyn Fn(&crate::packets::MqttPacket)+ Send>,
+ pub(crate) handle_qos1_acknowledge: HandleQos1AcknowledgeFn,
+ // handle_qos2_receive: Box<dyn Fn(&crate::packets::MqttPacket) + Send>,
+ // handle_qos2_complete: Box<dyn Fn(&crate::packets::MqttPacket) + Send>,
}
pub type OnPacketRecvFn = Box<dyn Fn(&crate::packets::MqttPacket) + Send>;
-pub type HandleAcknowledgeFn = Box<
+pub type HandleQos1AcknowledgeFn = Box<
dyn for<'p> Fn(&'p crate::packets::MqttPacket) -> futures::future::BoxFuture<'p, Acknowledge>
+ Send,
>;
@@ -230,7 +230,7 @@ impl Default for ClientHandlers {
fn default() -> Self {
Self {
on_packet_recv: Box::new(|_| ()),
- handle_acknowledge: Box::new(|_| async move { Acknowledge::Yes }.boxed()),
+ handle_qos1_acknowledge: Box::new(|_| async move { Acknowledge::Yes }.boxed()),
}
}
}