1
0
Fork 0

Simplify the link reversion logic.

ycs232-kbc
Jonathan Naylor 8 years ago committed by GitHub
parent d6c3f0fe32
commit e3827bbd1b

@ -346,12 +346,13 @@ int CYSFGateway::run()
inactivityTimer.clock(ms); inactivityTimer.clock(ms);
if (inactivityTimer.isRunning() && inactivityTimer.hasExpired()) { if (inactivityTimer.isRunning() && inactivityTimer.hasExpired()) {
if (m_linked) { if (m_linked) {
if (revert) { CYSFReflector* reflector = NULL;
CYSFReflector* reflector = m_wiresX->getReflector(startup); if (revert && !startup.empty() && m_wiresX != NULL)
reflector = m_wiresX->getReflector(startup);
if (reflector != NULL) { if (reflector != NULL) {
LogMessage("Reverting connection to %s", reflector->m_id.c_str()); LogMessage("Reverting connection to %5.5s", reflector->m_id.c_str());
if (m_wiresX != NULL)
m_wiresX->processConnect(reflector); m_wiresX->processConnect(reflector);
m_netNetwork->writeUnlink(); m_netNetwork->writeUnlink();
@ -379,22 +380,6 @@ int CYSFGateway::run()
lostTimer.stop(); lostTimer.stop();
pollTimer.stop(); pollTimer.stop();
m_linked = false;
}
} else {
LogMessage("Disconnecting due to inactivity");
if (m_wiresX != NULL)
m_wiresX->processDisconnect();
m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink();
m_netNetwork->clearDestination();
lostTimer.stop();
pollTimer.stop();
m_linked = false; m_linked = false;
} }
} }

Loading…
Cancel
Save