diff --git a/Common/G2ProtocolHandler.cpp b/Common/G2ProtocolHandler.cpp index 5592acd..8aff591 100644 --- a/Common/G2ProtocolHandler.cpp +++ b/Common/G2ProtocolHandler.cpp @@ -104,6 +104,7 @@ bool CG2ProtocolHandler::setBuffer(unsigned char * buffer, int length) // Header or data packet type? if ((m_buffer[14] & 0x80) == 0x80) { m_type = GT_HEADER; + m_id = 0U; // reset the id for new header } else { m_type = GT_AMBE; diff --git a/Common/G2ProtocolHandlerPool.cpp b/Common/G2ProtocolHandlerPool.cpp index 7db90d8..8ce4699 100644 --- a/Common/G2ProtocolHandlerPool.cpp +++ b/Common/G2ProtocolHandlerPool.cpp @@ -104,10 +104,10 @@ bool CG2ProtocolHandlerPool::readPackets() CG2ProtocolHandler * handler = findHandler(addr, IMT_ADDRESS_AND_PORT); if(handler == nullptr) { - CLog::logTrace("new incoming G2 %s:%u", inet_ntoa(TOIPV4(addr)->sin_addr), ntohs(TOIPV4(addr)->sin_port)); handler = new CG2ProtocolHandler(&m_socket, addr, G2_BUFFER_LENGTH); m_pool.push_back(handler); m_index = m_pool.end(); + CLog::logTrace("new incoming G2 %s:%u N G2 Count %d", inet_ntoa(TOIPV4(addr)->sin_addr), ntohs(TOIPV4(addr)->sin_port), m_pool.size()); } bool res = handler->setBuffer(buffer, length); @@ -135,6 +135,8 @@ bool CG2ProtocolHandlerPool::writeHeader(const CHeaderData& header) handler = new CG2ProtocolHandler(&m_socket, header.getDestination(), G2_BUFFER_LENGTH); m_pool.push_back(handler); m_index = m_pool.end(); + auto addr = header.getDestination(); + CLog::logTrace("new outgoing G2 %s:%u H G2 Count %d", inet_ntoa(TOIPV4(addr)->sin_addr), ntohs(TOIPV4(addr)->sin_port), m_pool.size()); } return handler->writeHeader(header); } @@ -149,6 +151,8 @@ bool CG2ProtocolHandlerPool::writeAMBE(const CAMBEData& data) handler = new CG2ProtocolHandler(&m_socket, data.getDestination(), G2_BUFFER_LENGTH); m_pool.push_back(handler); m_index = m_pool.end(); + auto addr = data.getDestination(); + CLog::logTrace("new outgoing G2 %s:%u A G2 Count %d", inet_ntoa(TOIPV4(addr)->sin_addr), ntohs(TOIPV4(addr)->sin_port), m_pool.size()); } return handler->writeAMBE(data); diff --git a/Common/RepeaterHandler.cpp b/Common/RepeaterHandler.cpp index 15171f7..804b2c5 100644 --- a/Common/RepeaterHandler.cpp +++ b/Common/RepeaterHandler.cpp @@ -1975,7 +1975,10 @@ void CRepeaterHandler::g2CommandHandler(const std::string& callsign, const std:: m_g2User = "CQCQCQ "; CRepeaterData* data = m_cache->findRepeater(m_g2Repeater); - m_irc->notifyRepeaterG2NatTraversal(m_g2Repeater); + if( data != NULL && data->getRepeater() == m_rptCallsign) { + // No point NAT traversal to ourselves + m_irc->notifyRepeaterG2NatTraversal(m_g2Repeater); + } if (data == NULL) { m_g2Status = G2_REPEATER; diff --git a/DStarGateway/DStarGatewayThread.cpp b/DStarGateway/DStarGatewayThread.cpp index d86922d..f6f0509 100644 --- a/DStarGateway/DStarGatewayThread.cpp +++ b/DStarGateway/DStarGatewayThread.cpp @@ -521,7 +521,7 @@ void CDStarGatewayThread::addRepeater(const std::string& callsign, const std::st CRepeaterHandler::add(callsign, band, address, port, hwType, reflector, atStartup, reconnect, dratsEnabled, frequency, offset, range, latitude, longitude, agl, description1, description2, url, handler, band1, band2, band3); std::string repeater = callsign; - repeater.resize(LONG_CALLSIGN_LENGTH - 1U); + repeater.resize(LONG_CALLSIGN_LENGTH - 1U, ' '); repeater += band; // Add a fixed address and protocol for the local repeaters diff --git a/README.md b/README.md index 3ed7adb..413612e 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ The testing framwework used is Google Test. - [**Bugfix**] Fix decoding of DTMF commands with leading 0 ([#61](https://github.com/F4FXL/DStarGateway/issues/61)) - [**Improvement**] Add second French voice ([#60](https://github.com/F4FXL/DStarGateway/issues/60)) - [**Improvement**] Clarify French "Linking to" announcement ([#60](https://github.com/F4FXL/DStarGateway/issues/60)) +- [**Bugfix**] Fix program stops responding and uses 100% cpu when cross banding using gateway call or callsign routing ([#62](https://github.com/F4FXL/DStarGateway/issues/62)) - [**Improvement**] Improve threading handling ([#58](https://github.com/F4FXL/DStarGateway/issues/58)) - [**Improvement**] Add Add an option to disable logging of ircddb traffic ([#59](https://github.com/F4FXL/DStarGateway/issues/59)) - [**Bugfix**] Fix repeater not reverting to startup reflector after issueing a command through remote control. ([#57](https://github.com/F4FXL/DStarGateway/issues/57))