ReflectorLogic bugfix: Temporary TG monitor could remove a permanent one

It was possible to activate a temporary TG monitor on a TG that was
configured to be permanent. When the temporary monitor timed out the
permananent TG was also removed from the monitoring list.
This commit is contained in:
Tobias Blomberg 2021-06-19 12:35:08 +02:00
parent acf385446f
commit a40c7cadf2
3 changed files with 30 additions and 10 deletions

View File

@ -158,6 +158,10 @@
setConfigValue function, to change behavior at runtime. See example in
ReflectorLogic.tcl.
* Bugfix in ReflectorLogic: It was possible to activate a temporary TG monitor
on a TG that was configured to be permanent. When the temporary monitor
timed out the TG was removed from the monitoring list completely.
1.7.0 -- 01 Sep 2019

View File

@ -479,6 +479,7 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
}
else if (cmd[0] == '4') // Temporarily monitor talk group
{
std::ostringstream os;
const std::string subcmd(cmd.substr(1));
if ((m_tmp_monitor_timeout > 0) && !subcmd.empty())
{
@ -489,10 +490,21 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
const MonitorTgsSet::iterator it = m_monitor_tgs.find(tg);
if (it != m_monitor_tgs.end())
{
std::cout << name() << ": Refresh temporary monitor for TG #"
<< tg << std::endl;
// NOTE: (*it).timeout is mutable
(*it).timeout = m_tmp_monitor_timeout;
if ((*it).timeout > 0)
{
std::cout << name() << ": Refresh temporary monitor for TG #"
<< tg << std::endl;
// NOTE: (*it).timeout is mutable
(*it).timeout = m_tmp_monitor_timeout;
os << "tmp_monitor_add " << tg;
}
else
{
std::cout << "*** WARNING: Not allowed to add a temporary montior "
"for TG #" << tg << " which is being permanently "
"monitored" << std::endl;
os << "command_failed " << cmd;
}
}
else
{
@ -503,20 +515,24 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
m_monitor_tgs.insert(mte);
sendMsg(MsgTgMonitor(std::set<uint32_t>(
m_monitor_tgs.begin(), m_monitor_tgs.end())));
os << "tmp_monitor_add " << tg;
}
std::ostringstream os;
os << "tmp_monitor_add " << tg;
processEvent(os.str());
}
else
{
processEvent(std::string("command_failed ") + cmd);
std::cout << "*** WARNING: Failed to parse temporary TG monitor "
"command: " << cmd << std::endl;
os << "command_failed " << cmd;
}
}
else
{
processEvent(std::string("command_failed ") + cmd);
std::cout << "*** WARNING: Ignoring temporary TG monitoring command ("
<< cmd << ") since that function is not enabled or there "
"were no TG specified" << std::endl;
os << "command_failed " << cmd;
}
processEvent(os.str());
}
else
{

View File

@ -11,7 +11,7 @@ LIBECHOLIB=1.3.3.99.0
LIBASYNC=1.6.99.15
# SvxLink versions
SVXLINK=1.7.99.51
SVXLINK=1.7.99.52
MODULE_HELP=1.0.0
MODULE_PARROT=1.1.1
MODULE_ECHO_LINK=1.5.99.2