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,11 +1395,18 @@ 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 "
m_HostProbeInformation.m_Timeout.reset(MDNS_PROBE_DELAY); "host probe to all links \n\n")););
++m_HostProbeInformation.m_u8SentCount;
} }
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 else // Probing finished
{ {
@ -1422,23 +1429,22 @@ 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;
if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount) ++m_HostProbeInformation.m_u8SentCount;
{
m_HostProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY); if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount)
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( {
PSTR("[MDNSResponder] _updateProbeStatus: Announcing host (%d).\n\n"), m_HostProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
m_HostProbeInformation.m_u8SentCount);); DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
} PSTR("[MDNSResponder] _updateProbeStatus: Announcing host (%d).\n\n"),
else m_HostProbeInformation.m_u8SentCount););
{ }
m_HostProbeInformation.m_Timeout.resetToNeverExpires(); else
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( {
PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n"));); 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))) 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)););
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 else // Probing finished
{ {
@ -1495,28 +1510,27 @@ 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;
if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount) ++pService->m_ProbeInformation.m_u8SentCount;
{
pService->m_ProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY); if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount)
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( {
PSTR("[MDNSResponder] _updateProbeStatus: Announcing service %s.%s.%s " pService->m_ProbeInformation.m_Timeout.reset(MDNS_ANNOUNCE_DELAY);
"(%d)\n\n"), DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(
(pService->m_pcName ?: m_pcHostname), pService->m_pcService, PSTR("[MDNSResponder] _updateProbeStatus: Announcing service %s.%s.%s "
pService->m_pcProtocol, pService->m_ProbeInformation.m_u8SentCount);); "(%d)\n\n"),
} (pService->m_pcName ?: m_pcHostname), pService->m_pcService,
else pService->m_pcProtocol, pService->m_ProbeInformation.m_u8SentCount););
{ }
pService->m_ProbeInformation.m_Timeout.resetToNeverExpires(); else
DEBUG_EX_INFO( {
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Done " pService->m_ProbeInformation.m_Timeout.resetToNeverExpires();
"service announcing for %s.%s.%s\n\n"), DEBUG_EX_INFO(
(pService->m_pcName ?: m_pcHostname), DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _updateProbeStatus: Done "
pService->m_pcService, pService->m_pcProtocol);); "service announcing for %s.%s.%s\n\n"),
} (pService->m_pcName ?: m_pcHostname),
pService->m_pcService, pService->m_pcProtocol););
} }
} }
} }