Dispatch Redis config.changed events to per-scope reload paths

This commit is contained in:
Audric committed 2026-04-15 08:57:08 +02:00
1 parent 2a3515247c
commit 977624febf
2 files changed
+30

No files matched your search

+28
View File
@@ -461,6 +461,8 @@ bool Reflector::initialize(Async::Config &cfg)
}; };
warn_if_nonempty("USERS"); warn_if_nonempty("USERS");
warn_if_nonempty("PASSWORDS"); warn_if_nonempty("PASSWORDS");
m_redis->configChanged.connect(
sigc::mem_fun(*this, &Reflector::onRedisConfigChanged));
} }
} }
@@ -2728,6 +2730,32 @@ void Reflector::onTrunkTalkerUpdated(uint32_t tg,
} /* Reflector::onTrunkTalkerUpdated */ } /* Reflector::onTrunkTalkerUpdated */
void Reflector::reloadClusterTgs(void)
{
// Stub — populated by Task C2 (Cluster TGs from Redis).
}
void Reflector::onRedisConfigChanged(std::string scope)
{
std::cout << "Redis config.changed: " << scope << std::endl;
if (scope == "users" || scope == "all") {
// Auth lookups are stateless (per-connect). Nothing to invalidate on
// existing connections — they are already authenticated. New
// connections will re-query Redis automatically.
}
if (scope == "cluster" || scope == "all") {
reloadClusterTgs();
}
if (scope.rfind("trunk:", 0) == 0 || scope == "all") {
std::string section = (scope == "all") ? "" : scope.substr(6);
for (auto* link : m_trunk_links) {
if (section.empty() || link->section() == section) link->reloadConfig();
}
}
}
void Reflector::publishRxUpdate(ReflectorClient* client) void Reflector::publishRxUpdate(ReflectorClient* client)
{ {
if (m_mqtt != nullptr && !client->callsign().empty()) if (m_mqtt != nullptr && !client->callsign().empty())
+2
View File
@@ -366,6 +366,8 @@ class Reflector : public sigc::trackable
void cfgUpdated(const std::string& section, const std::string& tag); void cfgUpdated(const std::string& section, const std::string& tag);
void onTrunkTalkerUpdated(uint32_t tg, std::string old_cs, void onTrunkTalkerUpdated(uint32_t tg, std::string old_cs,
std::string new_cs); std::string new_cs);
void onRedisConfigChanged(std::string scope);
void reloadClusterTgs(void);
void refreshStatus(void); void refreshStatus(void);
void initTrunkLinks(void); void initTrunkLinks(void);
void initTrunkServer(void); void initTrunkServer(void);