From cbffd5e01c87eb883e64feed633536309e396a42 Mon Sep 17 00:00:00 2001 From: hreintke Date: Sun, 17 Jul 2022 13:43:16 +0200 Subject: [PATCH 1/2] Also increase # of sends when a send fails --- libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp | 101 ++++++++++-------- 1 file changed, 58 insertions(+), 43 deletions(-) diff --git a/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp b/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp index 3d79f05ebc..7388c14326 100644 --- a/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp +++ b/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp @@ -1396,10 +1396,17 @@ 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; + 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,24 +1429,24 @@ 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 + + ++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"));); - } + 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 +1471,20 @@ 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,29 +1510,29 @@ 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 + + ++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);); - } + 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);); } + } } DEBUG_EX_ERR(if (!bResult) { From e7a7c0c43a79b38f4cef002801c7ef87cb488e60 Mon Sep 17 00:00:00 2001 From: hreintke Date: Mon, 18 Jul 2022 13:38:11 +0200 Subject: [PATCH 2/2] style update --- libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp b/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp index 7388c14326..e357cbab52 100644 --- a/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp +++ b/libraries/ESP8266mDNS/src/LEAmDNS_Control.cpp @@ -1395,18 +1395,18 @@ namespace MDNSImplementation { if ((bResult = _sendHostProbe())) { - DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( - PSTR("[MDNSResponder] _updateProbeStatus: Did sent host probe to all links \n\n"));); + 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"));); - + 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 { @@ -1430,7 +1430,7 @@ namespace MDNSImplementation && (m_HostProbeInformation.m_Timeout.expired())) { _announce(true, false); // Don't announce services here - + ++m_HostProbeInformation.m_u8SentCount; if (MDNS_ANNOUNCE_COUNT > m_HostProbeInformation.m_u8SentCount) @@ -1446,7 +1446,6 @@ namespace MDNSImplementation DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( PSTR("[MDNSResponder] _updateProbeStatus: Done host announcing.\n\n"));); } - } // @@ -1471,16 +1470,17 @@ namespace MDNSImplementation if ((bResult = _sendServiceProbe(*pService))) { DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P( - PSTR("[MDNSResponder] _updateProbeStatus: Did sent service probe to all links " + PSTR("[MDNSResponder] _updateProbeStatus: Did sent service probe to " + "all links " "(%u)\n\n"), (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"), + 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); @@ -1511,7 +1511,7 @@ namespace MDNSImplementation && (pService->m_ProbeInformation.m_Timeout.expired())) { _announceService(*pService); // Announce service - + ++pService->m_ProbeInformation.m_u8SentCount; if (MDNS_ANNOUNCE_COUNT > pService->m_ProbeInformation.m_u8SentCount) @@ -1519,7 +1519,7 @@ namespace MDNSImplementation 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"), + "(%d)\n\n"), (pService->m_pcName ?: m_pcHostname), pService->m_pcService, pService->m_pcProtocol, pService->m_ProbeInformation.m_u8SentCount);); } @@ -1528,11 +1528,10 @@ namespace MDNSImplementation 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);); + "service announcing for %s.%s.%s\n\n"), + (pService->m_pcName ?: m_pcHostname), + pService->m_pcService, pService->m_pcProtocol);); } - } } DEBUG_EX_ERR(if (!bResult) {