From d58331757d734e00bcb4466ffddbdac93b01d17f Mon Sep 17 00:00:00 2001 From: Patrik Lundin Date: Mon, 3 Jun 2024 12:13:35 +0200 Subject: [PATCH] Call MQTT StopEngine() on stop command --- apihandler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apihandler.go b/apihandler.go index 9b1416a..8618623 100644 --- a/apihandler.go +++ b/apihandler.go @@ -80,6 +80,12 @@ func APIcommand(conf *Config) func(w http.ResponseWriter, r *http.Request) { Status: "stopping", Msg: "Daemon was happy, but now winding down", } + log.Printf("Stopping MQTT engine\n") + _, err := conf.TemData.MqttEngine.StopEngine() + if err != nil { + resp.Error = true + resp.ErrorMsg = err.Error() + } conf.Internal.APIStopCh <- struct{}{} case "bump": resp.Msg, err = BumpSerial(conf, cp.Zone)