Handle unknown FCS reflector better.
This commit is contained in:
parent
28a0a78d84
commit
b56ef7051f
3 changed files with 30 additions and 17 deletions
|
@ -100,19 +100,19 @@ void CFCSNetwork::write(const unsigned char* data)
|
|||
m_socket.write(buffer, 130U, m_address, m_port);
|
||||
}
|
||||
|
||||
void CFCSNetwork::writeLink(const std::string& reflector)
|
||||
bool CFCSNetwork::writeLink(const std::string& reflector)
|
||||
{
|
||||
if (m_port == 0U) {
|
||||
std::string name = reflector.substr(0U, 6U);
|
||||
if (m_addresses.count(name) == 0U) {
|
||||
LogError("Unknown FCS reflector - %s", name.c_str());
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_address = m_addresses[name];
|
||||
if (m_address.s_addr == INADDR_NONE) {
|
||||
LogError("FCS reflector %s has no address", name.c_str());
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,8 @@ void CFCSNetwork::writeLink(const std::string& reflector)
|
|||
m_pingTimer.start();
|
||||
|
||||
m_state = FCS_LINKING;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CFCSNetwork::writeUnlink(unsigned int count)
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
void write(const unsigned char* data);
|
||||
|
||||
void writeLink(const std::string& reflector);
|
||||
bool writeLink(const std::string& reflector);
|
||||
|
||||
void writeUnlink(unsigned int count = 1U);
|
||||
|
||||
|
|
|
@ -552,14 +552,20 @@ void CYSFGateway::processDTMF(const unsigned char* buffer, unsigned char dt)
|
|||
if (m_linkType == LINK_FCS)
|
||||
m_fcsNetwork->writeUnlink(3U);
|
||||
|
||||
m_inactivityTimer.stop();
|
||||
m_lostTimer.stop();
|
||||
m_linkType = LINK_NONE;
|
||||
|
||||
LogMessage("Connect via DTMF to %s has been requested by %10.10s", id.c_str(), buffer + 14U);
|
||||
|
||||
m_fcsNetwork->writeLink(id);
|
||||
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
|
||||
m_linkType = LINK_FCS;
|
||||
bool ok = m_fcsNetwork->writeLink(id);
|
||||
if (ok) {
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
m_linkType = LINK_FCS;
|
||||
} else {
|
||||
LogMessage("Unknown reflector - %s", id.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WXS_DISCONNECT:
|
||||
|
@ -652,14 +658,19 @@ void CYSFGateway::startupLinking()
|
|||
if (startup.substr(0U, 3U) == "FCS" && m_fcsNetwork != NULL) {
|
||||
LogMessage("Automatic (re-)connection to %s", startup.c_str());
|
||||
|
||||
m_fcsNetwork->writeLink(startup);
|
||||
m_inactivityTimer.stop();
|
||||
m_lostTimer.stop();
|
||||
m_linkType = LINK_NONE;
|
||||
|
||||
if (!revert)
|
||||
m_inactivityTimer.start();
|
||||
|
||||
m_lostTimer.start();
|
||||
|
||||
m_linkType = LINK_FCS;
|
||||
bool ok = m_fcsNetwork->writeLink(startup);
|
||||
if (ok) {
|
||||
if (!revert)
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
m_linkType = LINK_FCS;
|
||||
} else {
|
||||
LogMessage("Unknown reflector - %s", startup.c_str());
|
||||
}
|
||||
} else if (m_ysfNetwork != NULL) {
|
||||
CYSFReflector* reflector = m_wiresX->getReflector(startup);
|
||||
if (reflector != NULL) {
|
||||
|
|
Loading…
Reference in a new issue