This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Fix MQTT implementation, align with DStarGateway, and add documentation#85
Open
MW0MWZ wants to merge 1 commit intog4klx:masterfrom
Open
Fix MQTT implementation, align with DStarGateway, and add documentation#85MW0MWZ wants to merge 1 commit intog4klx:masterfrom
MW0MWZ wants to merge 1 commit intog4klx:masterfrom
Conversation
MQTT Implementation (aligned with DStarGateway / MMDVMHost): - Rewrite MQTTConnection with mosquitto_loop_stop() fix to prevent background thread zombies on shutdown - Add MQTT authentication support (mqttAuth, mqttUsername, mqttPassword) - Add configurable client name (mqttName) used as topic prefix - Use PID-based client IDs (avoids time_t truncation on 32-bit ARM) - Use std::string interface throughout (no wxString in MQTT layer) - Align JSON link status fields with DStarGateway (repeater/reflector/ protocol/reason/action) for dashboard compatibility Shutdown Safety: - Add MQTTLogFinalise() calls to both daemon (IRCDDBGatewayAppD::run) and GUI (IRCDDBGatewayApp::OnExit) shutdown paths to ensure clean MQTT disconnection and thread cleanup before process exit JSON Status Events: - Update all ~30 WriteJSON call sites across DPlus, DExtra, DCS, and CCS protocol handlers to use new function signatures - Simplify IRCDDBGatewayThread::writeJSONStatus to delegate to WriteJSONStatus Config Parser Hardening: - Add empty-line crash guard to IRCDDBGatewayConfig, TimerControlConfig, and TimeServerConfig parsers (str.IsEmpty() check before GetChar) Documentation: - Add MQTT.md with topic structure, JSON examples, and troubleshooting - Add CONFIGURATION.md with full reference for all config files - Add BUILD.md with build parameters and dependency information - Add linux/ example configs for ircddbgateway, timeserver, timercontrol - Modernise README.md with feature list and DStarGateway recommendation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes and completes the existing MQTT support in ircDDBGateway, aligning it with the conventions established in DStarGateway and MMDVMHost. It also adds comprehensive documentation and example configuration files.
This is the first pass at these improvements; there may be follow-up commits required once validated on live hardware.
What's included
mosquitto_loop_stop()beforemosquitto_destroy()to prevent a background thread zombie/use-after-free on exit, andMQTTLogFinalise()calls in both daemon and GUI shutdown paths to ensure clean disconnectionrepeater,reflector,protocol,reason,action) so the same dashboard code works for both gatewaysmqttAuth,mqttUsername,mqttPasswordconfig keys for broker authenticationmqttNameconfig key, used as both the MQTT client name and topic prefixtime_ttruncation issue on 32-bit ARM (same fix as DStarGateway/MMDVMHost)str.IsEmpty()check beforeGetChar()) in IRCDDBGatewayConfig, TimerControlConfig, and TimeServerConfig parsersMQTT.md(config, topic structure, JSON examples, troubleshooting),CONFIGURATION.md(full reference for every config setting across all programs),BUILD.md(build parameters and dependencies), modernisedREADME.mdwith feature list and DStarGateway recommendationlinux/ircddbgateway.example,linux/timeserver.example,linux/timercontrol.examplewith correct defaultsMQTT is always compiled in
Unlike DStarRepeater (which uses
make MQTT=1), ircDDBGateway's Makefile unconditionally links-lmosquitto. MQTT code is always present in the binary. To disable MQTT at runtime, leavemqttAddressempty in the config file.JSON link events
All ~30
WriteJSONcall sites across DPlus, DExtra, DCS, and CCS protocol handlers have been updated to use the new DStarGateway-compatible signatures:{"link":{"timestamp":"2025-03-08T14:23:15Z","repeater":"GB7XX B","action":"linking","reason":"network","reflector":"REF001 C","protocol":"dextra"}}Files changed
Common/MQTTConnection.cpp,Common/MQTTConnection.hCommon/MQTTLog.cpp,Common/MQTTLog.hCommon/IRCDDBGatewayConfig.cpp,Common/IRCDDBGatewayConfig.hCommon/CCSHandler.cpp,Common/DCSHandler.cpp,Common/DExtraHandler.cpp,Common/DPlusHandler.cppircDDBGateway/IRCDDBGatewayApp.cpp,ircDDBGateway/IRCDDBGatewayAppD.cppircDDBGateway/IRCDDBGatewayThread.cppTimeServer/TimeServerConfig.cpp,TimerControl/TimerControlConfig.cppREADME.md,BUILD.md,MQTT.md,CONFIGURATION.mdlinux/ircddbgateway.example,linux/timeserver.example,linux/timercontrol.example