Merge branch 'bugfix/RemoteNoRevert_#57' into develop fixes #57

develop
Geoffrey Merck 4 months ago
commit cfdddfb487

@ -126,7 +126,7 @@ void CUtils::dump(const char* title, const unsigned char* data, unsigned int len
assert(title != NULL);
assert(data != NULL);
CLog::logInfo("%s\n", title);
CLog::logDebug("%s\n", title);
unsigned int offset = 0U;

@ -80,11 +80,12 @@ void CDCSProtocolHandlerPool::release(CDCSProtocolHandler *handler)
assert(handler != NULL);
for (auto it=m_pool.begin(); it!=m_pool.end(); it++) {
if (it->second == handler) {
unsigned int port = handler->getPort();
m_pool.erase(it);
handler->close();
delete handler ;
m_index = m_pool.end(); // since we removed an element, m_index is ouot of order, just move it back to the end
CLog::logInfo("Released DCS ProtocolHandler on port %u.\n", it->first);
m_index = m_pool.end(); // since we removed an element, m_index is out of order, just move it back to the end
CLog::logInfo("Released DCS ProtocolHandler on port %u.\n", port);
return;
}

@ -80,11 +80,12 @@ void CDExtraProtocolHandlerPool::release(CDExtraProtocolHandler *handler)
assert(handler != NULL);
for (auto it=m_pool.begin(); it!=m_pool.end(); it++) {
if (it->second == handler) {
unsigned int port = handler->getPort();
m_pool.erase(it);
handler->close();
delete handler;
m_index = m_pool.end(); // m_index might be out of order, reset it
CLog::logInfo("Releasing DExtra Protocol Handler on port %u.\n", it->first);
CLog::logInfo("Releasing DExtra Protocol Handler on port %u.\n", port);
return;
}

@ -81,11 +81,12 @@ void CDPlusProtocolHandlerPool::release(CDPlusProtocolHandler *handler)
assert(handler != NULL);
for (auto it=m_pool.begin(); it!=m_pool.end(); it++) {
if (it->second == handler) {
unsigned int port = handler->getPort();
m_pool.erase(it);
handler->close();
delete handler;
m_index = m_pool.end(); // m_index might be ut of order so reset it
CLog::logInfo("Releasing DPlus ProtocolHandler on port %u.\n", it->first);
CLog::logInfo("Releasing DPlus ProtocolHandler on port %u.\n", port);
return;
}
}

@ -50,6 +50,24 @@ enum RECONNECT {
RECONNECT_180MINS
};
inline const char* reconnectToString(RECONNECT r) {
switch (r) {
case RECONNECT_NEVER: return "never";
case RECONNECT_FIXED: return "fixed";
case RECONNECT_5MINS: return "5 minutes";
case RECONNECT_10MINS: return "10 minutes";
case RECONNECT_15MINS: return "15 minutes";
case RECONNECT_20MINS: return "20 minutes";
case RECONNECT_25MINS: return "25 minutes";
case RECONNECT_30MINS: return "30 minutes";
case RECONNECT_60MINS: return "60 minutes";
case RECONNECT_90MINS: return "90 minutes";
case RECONNECT_120MINS: return "120 minutes";
case RECONNECT_180MINS: return "180 minutes";
default: return "unknown";
}
}
enum DIRECTION {
DIR_INCOMING,
DIR_OUTGOING

@ -95,9 +95,9 @@ void CRemoteHandler::process()
RECONNECT reconnect;
m_handler.readLink(callsign, reconnect, reflector);
if (reflector.empty())
CLog::logInfo("Remote control user has linked \"%s\" to \"None\" with reconnect %d", callsign.c_str(), int(reconnect));
CLog::logInfo("Remote control user requesting link \"%s\" to \"None\" with reconnect %s", callsign.c_str(), reconnectToString(reconnect));
else
CLog::logInfo("Remote control user has linked \"%s\" to \"%s\" with reconnect %d", callsign.c_str(), reflector.c_str(), int(reconnect));
CLog::logInfo("Remote control user requesting link \"%s\" to \"%s\" with reconnect %s", callsign.c_str(), reflector.c_str(), reconnectToString(reconnect));
link(callsign, reconnect, reflector, true);
}
break;
@ -105,7 +105,7 @@ void CRemoteHandler::process()
std::string callsign, reflector;
PROTOCOL protocol;
m_handler.readUnlink(callsign, protocol, reflector);
CLog::logInfo("Remote control user has unlinked \"%s\" from \"%s\" for protocol %d", callsign.c_str(), reflector.c_str(), int(protocol));
CLog::logInfo("Remote control user requesting unlink \"%s\" from \"%s\" for protocol %d", callsign.c_str(), reflector.c_str(), int(protocol));
unlink(callsign, protocol, reflector);
}
break;
@ -114,9 +114,9 @@ void CRemoteHandler::process()
RECONNECT reconnect;
m_handler.readLinkScr(callsign, reconnect, reflector);
if (reflector.empty())
CLog::logInfo("Remote control user has linked \"%s\" to \"None\" with reconnect %d from localhost", callsign.c_str(), reconnect);
CLog::logInfo("Remote control user requesting link \"%s\" to \"None\" with reconnect %s from localhost", callsign.c_str(), reconnectToString(reconnect));
else
CLog::logInfo("Remote control user has linked \"%s\" to \"%s\" with reconnect %d from localhost", callsign.c_str(), reflector.c_str(), reconnect);
CLog::logInfo("Remote control user requesting link \"%s\" to \"%s\" with reconnect %s from localhost", callsign.c_str(), reflector.c_str(), reconnectToString(reconnect));
link(callsign, reconnect, reflector, false);
}
break;
@ -155,6 +155,7 @@ void CRemoteHandler::sendRepeater(const std::string& callsign)
{
CRepeaterHandler* repeater = CRepeaterHandler::findDVRepeater(callsign);
if (repeater == NULL) {
CLog::logInfo("Remote requesting invalid repeater \"%s\"", callsign.c_str());
m_handler.sendNAK("Invalid repeater callsign");
return;
}
@ -195,6 +196,7 @@ void CRemoteHandler::link(const std::string& callsign, RECONNECT reconnect, cons
{
CRepeaterHandler* repeater = CRepeaterHandler::findDVRepeater(callsign);
if (repeater == NULL) {
CLog::logInfo("Remote requesting link for invalid repeater \"%s\"", callsign.c_str());
m_handler.sendNAK("Invalid repeater callsign");
return;
}
@ -209,6 +211,7 @@ void CRemoteHandler::unlink(const std::string& callsign, PROTOCOL protocol, cons
{
CRepeaterHandler* repeater = CRepeaterHandler::findDVRepeater(callsign);
if (repeater == NULL) {
CLog::logInfo("Remote requesting unlink for invalid repeater \"%s\"", callsign.c_str());
m_handler.sendNAK("Invalid repeater callsign");
return;
}

@ -169,40 +169,7 @@ m_heardTimer(1000U, 0U, 100U) // 100ms
m_pollTimer.start();
switch (m_linkReconnect) {
case RECONNECT_5MINS:
m_linkReconnectTimer.start(5U * 60U);
break;
case RECONNECT_10MINS:
m_linkReconnectTimer.start(10U * 60U);
break;
case RECONNECT_15MINS:
m_linkReconnectTimer.start(15U * 60U);
break;
case RECONNECT_20MINS:
m_linkReconnectTimer.start(20U * 60U);
break;
case RECONNECT_25MINS:
m_linkReconnectTimer.start(25U * 60U);
break;
case RECONNECT_30MINS:
m_linkReconnectTimer.start(30U * 60U);
break;
case RECONNECT_60MINS:
m_linkReconnectTimer.start(60U * 60U);
break;
case RECONNECT_90MINS:
m_linkReconnectTimer.start(90U * 60U);
break;
case RECONNECT_120MINS:
m_linkReconnectTimer.start(120U * 60U);
break;
case RECONNECT_180MINS:
m_linkReconnectTimer.start(180U * 60U);
break;
default:
break;
}
setReconnectTimer(m_linkReconnect);
#ifdef USE_ANNOUNCE
wxFileName messageFile;
@ -1504,7 +1471,7 @@ void CRepeaterHandler::clockInt(unsigned int ms)
linkInt(m_linkStartup);
}
m_linkReconnectTimer.start();
setReconnectTimer(m_linkReconnect);
}
// If the ircDDB query timer has expired
@ -1842,45 +1809,9 @@ void CRepeaterHandler::link(RECONNECT reconnect, const std::string& reflector)
}
#endif
m_linkStartup = reflector;
m_linkReconnect = reconnect;
m_linkReconnectTimer.stop();
switch (m_linkReconnect) {
case RECONNECT_5MINS:
m_linkReconnectTimer.start(5U * 60U);
break;
case RECONNECT_10MINS:
m_linkReconnectTimer.start(10U * 60U);
break;
case RECONNECT_15MINS:
m_linkReconnectTimer.start(15U * 60U);
break;
case RECONNECT_20MINS:
m_linkReconnectTimer.start(20U * 60U);
break;
case RECONNECT_25MINS:
m_linkReconnectTimer.start(25U * 60U);
break;
case RECONNECT_30MINS:
m_linkReconnectTimer.start(30U * 60U);
break;
case RECONNECT_60MINS:
m_linkReconnectTimer.start(60U * 60U);
break;
case RECONNECT_90MINS:
m_linkReconnectTimer.start(90U * 60U);
break;
case RECONNECT_120MINS:
m_linkReconnectTimer.start(120U * 60U);
break;
case RECONNECT_180MINS:
m_linkReconnectTimer.start(180U * 60U);
break;
default:
break;
}
setReconnectTimer(reconnect);
// Nothing to do
if ((m_linkStatus != LS_NONE && m_linkRepeater == reflector) ||
@ -1973,7 +1904,7 @@ void CRepeaterHandler::link(RECONNECT reconnect, const std::string& reflector)
CDPlusHandler::unlink(this);
CDCSHandler::unlink(this);
linkInt(m_linkStartup);
linkInt(reflector);
}
void CRepeaterHandler::unlink(PROTOCOL protocol, const std::string& reflector)
@ -3085,6 +3016,24 @@ void CRepeaterHandler::readAPRSFrame(CAPRSFrame& frame)
}
}
void CRepeaterHandler::setReconnectTimer(RECONNECT reconnect)
{
CLog::logDebug("Reconnect timer set to %s", reconnectToString(reconnect));
switch (reconnect) {
case RECONNECT_5MINS: m_linkReconnectTimer.start( 5U * 60U); break;
case RECONNECT_10MINS: m_linkReconnectTimer.start(10U * 60U); break;
case RECONNECT_15MINS: m_linkReconnectTimer.start(15U * 60U); break;
case RECONNECT_20MINS: m_linkReconnectTimer.start(20U * 60U); break;
case RECONNECT_25MINS: m_linkReconnectTimer.start(25U * 60U); break;
case RECONNECT_30MINS: m_linkReconnectTimer.start(30U * 60U); break;
case RECONNECT_60MINS: m_linkReconnectTimer.start(60U * 60U); break;
case RECONNECT_90MINS: m_linkReconnectTimer.start(90U * 60U); break;
case RECONNECT_120MINS: m_linkReconnectTimer.start(120U * 60U); break;
case RECONNECT_180MINS: m_linkReconnectTimer.start(180U * 60U); break;
default: break;
}
}
#ifdef USE_CCS
bool CRepeaterHandler::isCCSCommand(const std::string& command) const
{

@ -317,6 +317,8 @@ private:
void triggerInfo();
void setReconnectTimer(RECONNECT reconnect);
#ifdef USE_CCS
bool isCCSCommand(const std::string& command) const;
#endif

@ -48,8 +48,11 @@ int main(int argc, const char* argv[])
::fprintf(stderr, "\ndgwremotecontrol v%s : invalid command line usage:\n\n", LONG_VERSION.c_str());
::fprintf(stderr, "\t\tdgwremotecontrol [-name <name>] <repeater> link <reconnect> <reflector>\n");
::fprintf(stderr, "\t\tdgwremotecontrol [-name <name>] <repeater> unlink\n");
#ifdef USE_STARNET
::fprintf(stderr, "\t\tdgwremotecontrol [-name <name>] <starnet> drop <user>\n");
::fprintf(stderr, "\t\tdgwremotecontrol [-name <name>] <starnet> drop all\n\n");
::fprintf(stderr, "\t\tdgwremotecontrol [-name <name>] <starnet> drop all\n");
#endif
::fprintf(stderr, "\n");
return 1;
}

@ -158,6 +158,7 @@ The testing framwework used is Google Test.
# 6. Version History
## 6.1. Version 1.0
- [**Bugfix**] Fix repeater not reverting to startup reflector after issueing a command through remote control. ([#56](https://github.com/F4FXL/DStarGateway/issues/56))
- [**Bugfix**] Fix corrupted slow data leading to DV Text Message not being sent to ircddb. Thanks to Manfred DL1JM for all the testing. ([#55](https://github.com/F4FXL/DStarGateway/issues/55))
- [**Improvement**] Add version info to output of --version ([#56](https://github.com/F4FXL/DStarGateway/issues/56))
- [**Improvement**] Automatically download hosts files on startup. It is also possible to specify custom hosts files to override hosts from the internet. Needs some configuration adjustement, see example.cfg. ([#50](https://github.com/F4FXL/DStarGateway/issues/50))

Loading…
Cancel
Save

Powered by TurnKey Linux.