correct runtime issue grabbing talkgroups that could cause a crash;

pull/134/head
Bryan Biedenkapp 5 days ago
parent fc59f50680
commit 38604c34f2

@ -58,9 +58,9 @@ TalkgroupRulesLookup::TalkgroupRulesLookup(const std::string& filename, uint32_t
m_acl(acl),
m_stop(false),
m_verbose(verbose),
m_groupVoice(),
m_groupHangTime(5U),
m_sendTalkgroups(false),
m_groupVoice()
m_sendTalkgroups(false)
{
/* stub */
}
@ -308,6 +308,22 @@ bool TalkgroupRulesLookup::getACL()
return m_acl;
}
/* Gets a snapshot of the group voice rules. */
std::vector<TalkgroupRuleGroupVoice> TalkgroupRulesLookup::groupVoice() const
{
std::lock_guard<std::mutex> lock(s_mutex);
return m_groupVoice;
}
/* Replaces the group voice rules. */
void TalkgroupRulesLookup::groupVoice(std::vector<TalkgroupRuleGroupVoice> val)
{
std::lock_guard<std::mutex> lock(s_mutex);
m_groupVoice = val;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------

@ -641,6 +641,17 @@ namespace lookups
*/
bool getACL();
/**
* @brief Gets a snapshot of the group voice rules.
* @return List of group voice rules.
*/
std::vector<TalkgroupRuleGroupVoice> groupVoice() const;
/**
* @brief Replaces the group voice rules.
* @param[in] val List of group voice rules.
*/
void groupVoice(std::vector<TalkgroupRuleGroupVoice> val);
/**
* @brief Returns the filename used to load this lookup table.
* @return std::string Full-path to the lookup table file.
@ -676,6 +687,8 @@ namespace lookups
bool m_verbose;
std::vector<TalkgroupRuleGroupVoice> m_groupVoice;
static std::mutex s_mutex; //!< Mutex used for change locking.
static bool s_locked; //!< Flag used for read locking (prevents find lookups), should be used when atomic operations (add/erase/etc) are being used.
@ -700,10 +713,6 @@ namespace lookups
* @brief Flag indicating whether or not the network layer should send the talkgroups to peers.
*/
DECLARE_PROPERTY_PLAIN(bool, sendTalkgroups);
/**
* @brief List of group voice rules.
*/
DECLARE_PROPERTY_PLAIN(std::vector<TalkgroupRuleGroupVoice>, groupVoice);
};
} // namespace lookups

Loading…
Cancel
Save

Powered by TurnKey Linux.