Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 58 additions & 44 deletions libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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")););
}
}

Expand All @@ -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
{
Expand All @@ -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););
}
}
}
Expand Down