diff --git a/src/svxlink/reflector/Reflector.cpp b/src/svxlink/reflector/Reflector.cpp index 467a842..2fbd97a 100644 --- a/src/svxlink/reflector/Reflector.cpp +++ b/src/svxlink/reflector/Reflector.cpp @@ -461,6 +461,8 @@ bool Reflector::initialize(Async::Config &cfg) }; warn_if_nonempty("USERS"); 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 */ +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) { if (m_mqtt != nullptr && !client->callsign().empty()) diff --git a/src/svxlink/reflector/Reflector.h b/src/svxlink/reflector/Reflector.h index 6e5481b..2a67ab0 100644 --- a/src/svxlink/reflector/Reflector.h +++ b/src/svxlink/reflector/Reflector.h @@ -366,6 +366,8 @@ class Reflector : public sigc::trackable void cfgUpdated(const std::string& section, const std::string& tag); void onTrunkTalkerUpdated(uint32_t tg, std::string old_cs, std::string new_cs); + void onRedisConfigChanged(std::string scope); + void reloadClusterTgs(void); void refreshStatus(void); void initTrunkLinks(void); void initTrunkServer(void);