1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-21 21:22:31 +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,12 +1395,19 @@ namespace MDNSImplementation
{ {
if ((bResult = _sendHostProbe())) if ((bResult = _sendHostProbe()))
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( DEBUG_EX_INFO(
PSTR("[MDNSResponder] _updateProbeStatus: Did sent host probe\n\n"));); 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_Timeout.reset(MDNS_PROBE_DELAY);
++m_HostProbeInformation.m_u8SentCount; ++m_HostProbeInformation.m_u8SentCount;
} }
}
else // Probing finished else // Probing finished
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
@ -1422,8 +1429,8 @@ namespace MDNSImplementation
else if ((ProbingStatus_Done == m_HostProbeInformation.m_ProbingStatus) else if ((ProbingStatus_Done == m_HostProbeInformation.m_ProbingStatus)
&& (m_HostProbeInformation.m_Timeout.expired())) && (m_HostProbeInformation.m_Timeout.expired()))
{ {
if ((bResult = _announce(true, false))) // Don't announce services here _announce(true, false); // Don't announce services here
{
++m_HostProbeInformation.m_u8SentCount; ++m_HostProbeInformation.m_u8SentCount;
if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount) if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount)
@ -1440,7 +1447,6 @@ namespace MDNSImplementation
PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n"));); PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n")););
} }
} }
}
// //
// Probe services // Probe services
@ -1464,13 +1470,22 @@ namespace MDNSImplementation
if ((bResult = _sendServiceProbe(*pService))) if ((bResult = _sendServiceProbe(*pService)))
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( 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"), "(%u)\n\n"),
(pService->m_ProbeInformation.m_u8SentCount + 1));); (pService->m_ProbeInformation.m_u8SentCount + 1)););
}
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_Timeout.reset(MDNS_PROBE_DELAY);
++pService->m_ProbeInformation.m_u8SentCount; ++pService->m_ProbeInformation.m_u8SentCount;
} }
}
else // Probing finished else // Probing finished
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: " DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: "
@ -1495,8 +1510,8 @@ namespace MDNSImplementation
else if ((ProbingStatus_Done == pService->m_ProbeInformation.m_ProbingStatus) else if ((ProbingStatus_Done == pService->m_ProbeInformation.m_ProbingStatus)
&& (pService->m_ProbeInformation.m_Timeout.expired())) && (pService->m_ProbeInformation.m_Timeout.expired()))
{ {
if ((bResult = _announceService(*pService))) // Announce service _announceService(*pService); // Announce service
{
++pService->m_ProbeInformation.m_u8SentCount; ++pService->m_ProbeInformation.m_u8SentCount;
if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount) if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount)
@ -1519,7 +1534,6 @@ namespace MDNSImplementation
} }
} }
} }
}
DEBUG_EX_ERR(if (!bResult) { DEBUG_EX_ERR(if (!bResult) {
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: FAILED!\n\n")); DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: FAILED!\n\n"));
}); });