|
|
@ -191,8 +191,8 @@ void CYSFReflector::run()
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int len = network.readData(buffer, 200U, address, port);
|
|
|
|
unsigned int len = network.readData(buffer, 200U, address, port);
|
|
|
|
if (len > 0U) {
|
|
|
|
if (len > 0U) {
|
|
|
|
if (::memcmp(buffer, "YSFP", 4U) == 0) {
|
|
|
|
|
|
|
|
CYSFRepeater* rpt = findRepeater(address, port);
|
|
|
|
CYSFRepeater* rpt = findRepeater(address, port);
|
|
|
|
|
|
|
|
if (::memcmp(buffer, "YSFP", 4U) == 0) {
|
|
|
|
if (rpt == NULL) {
|
|
|
|
if (rpt == NULL) {
|
|
|
|
rpt = new CYSFRepeater;
|
|
|
|
rpt = new CYSFRepeater;
|
|
|
|
rpt->m_callsign = std::string((char*)(buffer + 4U), 10U);
|
|
|
|
rpt->m_callsign = std::string((char*)(buffer + 4U), 10U);
|
|
|
@ -204,18 +204,18 @@ void CYSFReflector::run()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rpt->m_timer.start();
|
|
|
|
rpt->m_timer.start();
|
|
|
|
network.writePoll(address, port);
|
|
|
|
network.writePoll(address, port);
|
|
|
|
} else if (::memcmp(buffer + 0U, "YSFU", 4U) == 0) {
|
|
|
|
} else if (::memcmp(buffer + 0U, "YSFU", 4U) == 0 && rpt != NULL) {
|
|
|
|
CYSFRepeater* rpt = findRepeater(address, port);
|
|
|
|
|
|
|
|
if (rpt != NULL) {
|
|
|
|
|
|
|
|
LogMessage("Removing %s (unlinked)", rpt->m_callsign.c_str());
|
|
|
|
LogMessage("Removing %s (unlinked)", rpt->m_callsign.c_str());
|
|
|
|
std::vector<CYSFRepeater*>::iterator it = std::find(m_repeaters.begin(), m_repeaters.end(), rpt);
|
|
|
|
for (std::vector<CYSFRepeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
|
|
|
|
if (it != m_repeaters.end())
|
|
|
|
CYSFRepeater* itRpt = *it;
|
|
|
|
|
|
|
|
if (itRpt->m_address.s_addr == rpt->m_address.s_addr && itRpt->m_port == rpt->m_port) {
|
|
|
|
m_repeaters.erase(it);
|
|
|
|
m_repeaters.erase(it);
|
|
|
|
network.setCount(m_repeaters.size());
|
|
|
|
delete itRpt;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (::memcmp(buffer + 0U, "YSFD", 4U) == 0) {
|
|
|
|
}
|
|
|
|
CYSFRepeater* rpt = findRepeater(address, port);
|
|
|
|
network.setCount(m_repeaters.size());
|
|
|
|
if (rpt != NULL) {
|
|
|
|
} else if (::memcmp(buffer + 0U, "YSFD", 4U) == 0 && rpt != NULL) {
|
|
|
|
if (!watchdogTimer.isRunning()) {
|
|
|
|
if (!watchdogTimer.isRunning()) {
|
|
|
|
::memcpy(tag, buffer + 4U, YSF_CALLSIGN_LENGTH);
|
|
|
|
::memcpy(tag, buffer + 4U, YSF_CALLSIGN_LENGTH);
|
|
|
|
|
|
|
|
|
|
|
@ -262,7 +262,6 @@ void CYSFReflector::run()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int ms = stopWatch.elapsed();
|
|
|
|
unsigned int ms = stopWatch.elapsed();
|
|
|
|
stopWatch.start();
|
|
|
|
stopWatch.start();
|
|
|
@ -279,9 +278,11 @@ void CYSFReflector::run()
|
|
|
|
(*it)->m_timer.clock(ms);
|
|
|
|
(*it)->m_timer.clock(ms);
|
|
|
|
|
|
|
|
|
|
|
|
for (std::vector<CYSFRepeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
|
|
|
|
for (std::vector<CYSFRepeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
|
|
|
|
if ((*it)->m_timer.hasExpired()) {
|
|
|
|
CYSFRepeater* itRpt = *it;
|
|
|
|
LogMessage("Removing %s (polls lost)", (*it)->m_callsign.c_str());
|
|
|
|
if (itRpt->m_timer.hasExpired()) {
|
|
|
|
|
|
|
|
LogMessage("Removing %s (polls lost)", itRpt->m_callsign.c_str());
|
|
|
|
m_repeaters.erase(it);
|
|
|
|
m_repeaters.erase(it);
|
|
|
|
|
|
|
|
delete itRpt;
|
|
|
|
network.setCount(m_repeaters.size());
|
|
|
|
network.setCount(m_repeaters.size());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|