1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-14 13:41:23 +03:00

LEAmDNS Fixes 1.1 (#5619)

* Fixes 1.1

- Better separation of ESP wifi thread code from user thread code
- Added a flag for 'update()'-less use (disabled by default)
- The too fast updates for service queries are fixed
- Switched fully to PolledTimeout; LEATimeFlag not needed anymore (BTW: a const 'expired()' method would be helpful)
- The device should stay visible now even after the first TTL timeout
- Improved service querying (queries five times now)

* Update mDNS_Clock.ino

Removed references to LEATimeFlag.h

* Update mDNS_Clock.ino

Styling
This commit is contained in:
LaborEtArs
2019-01-18 19:59:26 +01:00
committed by Develo
parent 6883beedec
commit 570b9a6b6a
9 changed files with 533 additions and 331 deletions

View File

@ -55,7 +55,12 @@ MDNSResponder::MDNSResponder(void)
m_pcHostname(0),
m_pServiceQueries(0),
m_fnServiceTxtCallback(0),
m_pServiceTxtCallbackUserdata(0) {
m_pServiceTxtCallbackUserdata(0),
#ifdef ENABLE_ESP_MDNS_RESPONDER_PASSIV_MODE
m_bPassivModeEnabled(true) {
#else
m_bPassivModeEnabled(false) {
#endif
}
@ -123,7 +128,7 @@ bool MDNSResponder::begin(const char* p_pcHostname,
*/
bool MDNSResponder::close(void) {
_announce(false);
_announce(false, true);
_resetProbeStatus(false); // Stop probing
_releaseServiceQueries();
@ -205,6 +210,7 @@ MDNSResponder::hMDNSService MDNSResponder::addService(const char* p_pcName,
}
}
} // else: bad arguments
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addService: %s to add '%s.%s.%s'!\n"), (hResult ? "Succeeded" : "FAILED"), (p_pcName ?: "-"), p_pcService, p_pcProtocol); );
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] addService: FAILED to add '%s.%s.%s'!\n"), (p_pcName ?: "-"), p_pcService, p_pcProtocol); } );
return hResult;
}
@ -768,13 +774,17 @@ MDNSResponder::hMDNSServiceQuery MDNSResponder::installServiceQuery(const char*
pServiceQuery->m_bLegacyQuery = false;
if (_sendMDNSServiceQuery(*pServiceQuery)) {
pServiceQuery->m_u8SentCount = 1;
pServiceQuery->m_ResendTimeout.reset(MDNS_DYNAMIC_QUERY_RESEND_DELAY);
hResult = (hMDNSServiceQuery)pServiceQuery;
}
else {
_removeServiceQuery(pServiceQuery);
}
}
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] installServiceQuery: FAILED for '%s.%s'!\n"), (p_pcService ?: "-"), (p_pcProtocol ?: "-")); } );
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] installServiceQuery: %s for '%s.%s'!\n\n"), (hResult ? "Succeeded" : "FAILED"), (p_pcService ?: "-"), (p_pcProtocol ?: "-")););
DEBUG_EX_ERR(if (!hResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] installServiceQuery: FAILED for '%s.%s'!\n\n"), (p_pcService ?: "-"), (p_pcProtocol ?: "-")); } );
return hResult;
}
@ -1073,6 +1083,9 @@ bool MDNSResponder::notifyAPChange(void) {
*/
bool MDNSResponder::update(void) {
if (m_bPassivModeEnabled) {
m_bPassivModeEnabled = false;
}
return _process(true);
}
@ -1083,7 +1096,7 @@ bool MDNSResponder::update(void) {
*/
bool MDNSResponder::announce(void) {
return (_announce());
return (_announce(true, true));
}
/*