From 18e6b7af4ec7ea22abfd02e89c8775d55edb55ba Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Mon, 3 Jul 2023 16:20:38 -0700 Subject: [PATCH] let CONTROL msgs fail early --- broker/src/mqtt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/broker/src/mqtt.rs b/broker/src/mqtt.rs index b58077a..f490a33 100644 --- a/broker/src/mqtt.rs +++ b/broker/src/mqtt.rs @@ -164,7 +164,13 @@ fn pub_and_wait( } else { // for a specific client log::debug!("publishing to a specific client"); - pub_timeout(&cid, &msg.topic, &msg.message, &msg_rx, link_tx) + let res_opt = pub_timeout(&cid, &msg.topic, &msg.message, &msg_rx, link_tx); + // control topic should be able to fail early without retrying + if res_opt.is_none() && msg.topic == topics::CONTROL { + Some(ChannelReply::empty()) + } else { + res_opt + } } } else { log::debug!("publishing to all clients");