1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-20 10:24:18 +03:00

MDNS : Also increase # of sends when a send fails (#8641)

This solves the root cause of the infinite sending of host probes when STA is not connected.
This commit is contained in:
hreintke
2022-07-27 23:33:18 +02:00
committed by GitHub
parent d44c3f42a3
commit e2a36ed6c2

View File

@ -1395,11 +1395,18 @@ namespace MDNSImplementation
{
if ((bResult = _sendHostProbe()))
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Did sent host probe\n\n")););
m_HostProbeInformation.m_Timeout.reset(MDNS_PROBE_DELAY);
++m_HostProbeInformation.m_u8SentCount;
DEBUG_EX_INFO(
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Did sent "
"host probe to all links \n\n")););
}
else
{
DEBUG_EX_INFO(
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Did not "
"sent host probe to all links\n\n")););
}
m_HostProbeInformation.m_Timeout.reset(MDNS_PROBE_DELAY);
++m_HostProbeInformation.m_u8SentCount;
}
else // Probing finished
{
@ -1422,23 +1429,22 @@ namespace MDNSImplementation
else if ((ProbingStatus_Done == m_HostProbeInformation.m_ProbingStatus)
&& (m_HostProbeInformation.m_Timeout.expired()))
{
if ((bResult = _announce(true, false))) // Don't announce services here
{
++m_HostProbeInformation.m_u8SentCount;
_announce(true, false); // Don't announce services here
if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount)
{
m_HostProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Announcing host (%d).\n\n"),
m_HostProbeInformation.m_u8SentCount););
}
else
{
m_HostProbeInformation.m_Timeout.resetToNeverExpires();
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n")););
}
++m_HostProbeInformation.m_u8SentCount;
if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount)
{
m_HostProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Announcing host (%d).\n\n"),
m_HostProbeInformation.m_u8SentCount););
}
else
{
m_HostProbeInformation.m_Timeout.resetToNeverExpires();
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n")););
}
}
@ -1464,12 +1470,21 @@ namespace MDNSImplementation
if ((bResult = _sendServiceProbe(*pService)))
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Did sent service probe "
PSTR("[MDNSResponder] _updateProbeStatus: Did sent service probe to "
"all links "
"(%u)\n\n"),
(pService->m_ProbeInformation.m_u8SentCount + 1)););
pService->m_ProbeInformation.m_Timeout.reset(MDNS_PROBE_DELAY);
++pService->m_ProbeInformation.m_u8SentCount;
}
else
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Did not sent service probe "
"to all links"
"(%u)\n\n"),
(pService->m_ProbeInformation.m_u8SentCount + 1)););
}
pService->m_ProbeInformation.m_Timeout.reset(MDNS_PROBE_DELAY);
++pService->m_ProbeInformation.m_u8SentCount;
}
else // Probing finished
{
@ -1495,28 +1510,27 @@ namespace MDNSImplementation
else if ((ProbingStatus_Done == pService->m_ProbeInformation.m_ProbingStatus)
&& (pService->m_ProbeInformation.m_Timeout.expired()))
{
if ((bResult = _announceService(*pService))) // Announce service
{
++pService->m_ProbeInformation.m_u8SentCount;
_announceService(*pService); // Announce service
if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount)
{
pService->m_ProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Announcing service %s.%s.%s "
"(%d)\n\n"),
(pService->m_pcName ?: m_pcHostname), pService->m_pcService,
pService->m_pcProtocol, pService->m_ProbeInformation.m_u8SentCount););
}
else
{
pService->m_ProbeInformation.m_Timeout.resetToNeverExpires();
DEBUG_EX_INFO(
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Done "
"service announcing for %s.%s.%s\n\n"),
(pService->m_pcName ?: m_pcHostname),
pService->m_pcService, pService->m_pcProtocol););
}
++pService->m_ProbeInformation.m_u8SentCount;
if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount)
{
pService->m_ProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
PSTR("[MDNSResponder] _updateProbeStatus: Announcing service %s.%s.%s "
"(%d)\n\n"),
(pService->m_pcName ?: m_pcHostname), pService->m_pcService,
pService->m_pcProtocol, pService->m_ProbeInformation.m_u8SentCount););
}
else
{
pService->m_ProbeInformation.m_Timeout.resetToNeverExpires();
DEBUG_EX_INFO(
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Done "
"service announcing for %s.%s.%s\n\n"),
(pService->m_pcName ?: m_pcHostname),
pService->m_pcService, pService->m_pcProtocol););
}
}
}