Do not update G2 cache when nothing has been read from socket

This commit is contained in:
Geoffrey Merck F4FXL - KC3FRA 2018-11-18 17:14:29 +01:00
parent cda4300f34
commit 9f1a1d841a
2 changed files with 4 additions and 1 deletions

View file

@ -89,6 +89,8 @@ bool CG2ProtocolHandler::readPackets(in_addr& incomingAddress, unsigned int& inc
{
m_type = GT_NONE;
incomingPort = 0;
// No more data?
int length = m_socket.read(m_buffer, BUFFER_LENGTH, incomingAddress, incomingPort);
if (length <= 0)

View file

@ -1054,7 +1054,8 @@ void CIRCDDBGatewayThread::processG2()
default:
//Probably someone punching a UDP hole to us, keep track of that
m_cache.updateGatewayG2(wxT(""), incomingAddress, incomingPort);
if(incomingPort > 0 && incomingPort < 65536)
m_cache.updateGatewayG2(wxT(""), incomingAddress, incomingPort);
return;
}
}