1
0
Fork 0

Unlink before linking.

ycs232-kbc
Jonathan Naylor 8 years ago
parent 4b022094ca
commit e03a62ec7e

@ -221,12 +221,15 @@ int CYSFGateway::run()
CYSFReflector* reflector = m_wiresX->getReflector(startup); CYSFReflector* reflector = m_wiresX->getReflector(startup);
if (reflector != NULL) { if (reflector != NULL) {
LogMessage("Automatic connection to %5.5s", reflector->m_id.c_str()); LogMessage("Automatic connection to %5.5s", reflector->m_id.c_str());
m_netNetwork->setDestination(reflector->m_address, reflector->m_port); m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
m_netNetwork->writePoll(); m_netNetwork->writePoll();
m_netNetwork->writePoll(); m_netNetwork->writePoll();
m_netNetwork->writePoll(); m_netNetwork->writePoll();
lostTimer.start(); lostTimer.start();
pollTimer.start(); pollTimer.start();
m_linked = true; m_linked = true;
} }
} }
@ -258,25 +261,35 @@ int CYSFGateway::run()
WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft); WX_STATUS status = m_wiresX->process(buffer + 35U, buffer + 14U, fi, dt, fn, ft);
switch (status) { switch (status) {
case WXS_CONNECT: { case WXS_CONNECT: {
m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink();
CYSFReflector* reflector = m_wiresX->getReflector(); CYSFReflector* reflector = m_wiresX->getReflector();
LogMessage("Connect to %5.5s has been requested by %10.10s", reflector->m_id.c_str(), buffer + 14U); LogMessage("Connect to %5.5s has been requested by %10.10s", reflector->m_id.c_str(), buffer + 14U);
m_netNetwork->setDestination(reflector->m_address, reflector->m_port); m_netNetwork->setDestination(reflector->m_address, reflector->m_port);
m_netNetwork->writePoll(); m_netNetwork->writePoll();
m_netNetwork->writePoll(); m_netNetwork->writePoll();
m_netNetwork->writePoll(); m_netNetwork->writePoll();
lostTimer.start(); lostTimer.start();
pollTimer.start(); pollTimer.start();
m_linked = true; m_linked = true;
} }
break; break;
case WXS_DISCONNECT: case WXS_DISCONNECT:
LogMessage("Disconnect has been requested by %10.10s", buffer + 14U); LogMessage("Disconnect has been requested by %10.10s", buffer + 14U);
m_netNetwork->writeUnlink(); m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink(); m_netNetwork->writeUnlink();
m_netNetwork->writeUnlink(); m_netNetwork->writeUnlink();
m_netNetwork->setDestination(); m_netNetwork->setDestination();
lostTimer.stop(); lostTimer.stop();
pollTimer.stop(); pollTimer.stop();
m_linked = false; m_linked = false;
break; break;
default: default:

Loading…
Cancel
Save