make sure reconnect from config is use after reverting from remote initiated connect. Improve logging of reconnect time. #57

develop
Geoffrey Merck 4 months ago
parent e0864623ee
commit 24ca3d73ea

@ -50,6 +50,24 @@ enum RECONNECT {
RECONNECT_180MINS 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 { enum DIRECTION {
DIR_INCOMING, DIR_INCOMING,
DIR_OUTGOING DIR_OUTGOING

@ -95,9 +95,9 @@ void CRemoteHandler::process()
RECONNECT reconnect; RECONNECT reconnect;
m_handler.readLink(callsign, reconnect, reflector); m_handler.readLink(callsign, reconnect, reflector);
if (reflector.empty()) if (reflector.empty())
CLog::logInfo("Remote control user requesting link \"%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 else
CLog::logInfo("Remote control user requesting link \"%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); link(callsign, reconnect, reflector, true);
} }
break; break;
@ -114,9 +114,9 @@ void CRemoteHandler::process()
RECONNECT reconnect; RECONNECT reconnect;
m_handler.readLinkScr(callsign, reconnect, reflector); m_handler.readLinkScr(callsign, reconnect, reflector);
if (reflector.empty()) if (reflector.empty())
CLog::logInfo("Remote control user requesting link \"%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 else
CLog::logInfo("Remote control user requesting link \"%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); link(callsign, reconnect, reflector, false);
} }
break; break;

@ -169,40 +169,7 @@ m_heardTimer(1000U, 0U, 100U) // 100ms
m_pollTimer.start(); m_pollTimer.start();
switch (m_linkReconnect) { setReconnectTimer(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;
}
#ifdef USE_ANNOUNCE #ifdef USE_ANNOUNCE
wxFileName messageFile; wxFileName messageFile;
@ -1504,7 +1471,7 @@ void CRepeaterHandler::clockInt(unsigned int ms)
linkInt(m_linkStartup); linkInt(m_linkStartup);
} }
m_linkReconnectTimer.start(); setReconnectTimer(m_linkReconnect);
} }
// If the ircDDB query timer has expired // If the ircDDB query timer has expired
@ -1847,40 +1814,7 @@ void CRepeaterHandler::link(RECONNECT reconnect, const std::string& reflector)
m_linkReconnectTimer.stop(); m_linkReconnectTimer.stop();
switch (reconnect) { setReconnectTimer(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;
}
// Nothing to do // Nothing to do
if ((m_linkStatus != LS_NONE && m_linkRepeater == reflector) || if ((m_linkStatus != LS_NONE && m_linkRepeater == reflector) ||
@ -3085,6 +3019,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 #ifdef USE_CCS
bool CRepeaterHandler::isCCSCommand(const std::string& command) const bool CRepeaterHandler::isCCSCommand(const std::string& command) const
{ {

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

Loading…
Cancel
Save

Powered by TurnKey Linux.