Fix Wires-X connection reply when reflector is busy
This commit is contained in:
parent
11dcf748f3
commit
548edc3768
3 changed files with 25 additions and 4 deletions
|
@ -63,7 +63,9 @@ m_csd2(NULL),
|
|||
m_csd3(NULL),
|
||||
m_status(WXSI_NONE),
|
||||
m_start(0U),
|
||||
m_search()
|
||||
m_search(),
|
||||
m_busy(false),
|
||||
m_busyTimer(3000U, 1U)
|
||||
{
|
||||
assert(network != NULL);
|
||||
|
||||
|
@ -362,6 +364,9 @@ void CWiresX::processAll(const unsigned char* source, const unsigned char* data)
|
|||
|
||||
WX_STATUS CWiresX::processConnect(const unsigned char* source, const unsigned char* data)
|
||||
{
|
||||
m_busy = true;
|
||||
m_busyTimer.start();
|
||||
|
||||
::LogDebug("Received Connect to %5.5s from %10.10s", data, source);
|
||||
|
||||
std::string id = std::string((char*)data, 5U);
|
||||
|
@ -385,6 +390,9 @@ WX_STATUS CWiresX::processConnect(const unsigned char* source, const unsigned ch
|
|||
|
||||
void CWiresX::processConnect(CYSFReflector* reflector)
|
||||
{
|
||||
m_busy = true;
|
||||
m_busyTimer.start();
|
||||
|
||||
m_reflector = reflector;
|
||||
|
||||
m_status = WXSI_CONNECT;
|
||||
|
@ -434,6 +442,12 @@ void CWiresX::clock(unsigned int ms)
|
|||
m_status = WXSI_NONE;
|
||||
m_timer.stop();
|
||||
}
|
||||
|
||||
m_busyTimer.clock(ms);
|
||||
if (m_busyTimer.isRunning() && m_busyTimer.hasExpired()) {
|
||||
m_busy = false;
|
||||
m_busyTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void CWiresX::createReply(const unsigned char* data, unsigned int length, CYSFNetwork* network)
|
||||
|
@ -1026,3 +1040,8 @@ void CWiresX::sendCategoryReply()
|
|||
m_seqNo++;
|
||||
}
|
||||
|
||||
bool CWiresX::isBusy()
|
||||
{
|
||||
return m_busy;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
void addFCSRoom(const std::string& id, const std::string& name);
|
||||
|
||||
bool start();
|
||||
bool isBusy();
|
||||
|
||||
WX_STATUS process(const unsigned char* data, const unsigned char* source, unsigned char fi, unsigned char dt, unsigned char fn, unsigned char ft, bool wiresXCommandPassthrough);
|
||||
|
||||
|
@ -89,7 +90,8 @@ private:
|
|||
unsigned int m_start;
|
||||
std::string m_search;
|
||||
std::vector<CYSFReflector*> m_category;
|
||||
bool m_wiresXCommandPassthrough;
|
||||
bool m_busy;
|
||||
CTimer m_busyTimer;
|
||||
|
||||
WX_STATUS processConnect(const unsigned char* source, const unsigned char* data);
|
||||
void processDX(const unsigned char* source);
|
||||
|
|
|
@ -317,7 +317,7 @@ int CYSFGateway::run()
|
|||
while (m_ysfNetwork->read(buffer) > 0U) {
|
||||
if (m_linkType == LINK_YSF) {
|
||||
// Only pass through YSF data packets
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0 && !m_wiresX->isBusy())
|
||||
rptNetwork.write(buffer);
|
||||
|
||||
m_lostTimer.start();
|
||||
|
@ -329,7 +329,7 @@ int CYSFGateway::run()
|
|||
while (m_fcsNetwork->read(buffer) > 0U) {
|
||||
if (m_linkType == LINK_FCS) {
|
||||
// Only pass through YSF data packets
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0)
|
||||
if (::memcmp(buffer + 0U, "YSFD", 4U) == 0 && !m_wiresX->isBusy())
|
||||
rptNetwork.write(buffer);
|
||||
|
||||
m_lostTimer.start();
|
||||
|
|
Loading…
Reference in a new issue