mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-14 13:41:23 +03:00
LEAmDNS Fixes (#5641)
- 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) - Fixed TTL (bug introduced with Fixes 1.0)
This commit is contained in:
committed by
david gauchard
parent
e9a6fd2f82
commit
a89ab24edc
@ -87,21 +87,26 @@ MDNSResponder::~MDNSResponder(void) {
|
||||
*/
|
||||
bool MDNSResponder::begin(const char* p_pcHostname) {
|
||||
|
||||
bool bResult = false;
|
||||
bool bResult = (0 != m_pcHostname);
|
||||
|
||||
if (_setHostname(p_pcHostname)) {
|
||||
|
||||
m_GotIPHandler = WiFi.onStationModeGotIP([this](const WiFiEventStationModeGotIP& pEvent) {
|
||||
(void) pEvent;
|
||||
_restart();
|
||||
});
|
||||
|
||||
m_DisconnectedHandler = WiFi.onStationModeDisconnected([this](const WiFiEventStationModeDisconnected& pEvent) {
|
||||
(void) pEvent;
|
||||
_restart();
|
||||
});
|
||||
if (0 == m_pcHostname) {
|
||||
if (_setHostname(p_pcHostname)) {
|
||||
|
||||
bResult = _restart();
|
||||
m_GotIPHandler = WiFi.onStationModeGotIP([this](const WiFiEventStationModeGotIP& pEvent) {
|
||||
(void) pEvent;
|
||||
_restart();
|
||||
});
|
||||
|
||||
m_DisconnectedHandler = WiFi.onStationModeDisconnected([this](const WiFiEventStationModeDisconnected& pEvent) {
|
||||
(void) pEvent;
|
||||
_restart();
|
||||
});
|
||||
|
||||
bResult = _restart();
|
||||
}
|
||||
}
|
||||
else {
|
||||
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] begin: Ignoring multiple calls (Ignored host domain: '%s')!\n"), (p_pcHostname ?: "-")););
|
||||
}
|
||||
DEBUG_EX_ERR(if (!bResult) { DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] begin: FAILED for '%s'!\n"), (p_pcHostname ?: "-")); } );
|
||||
return bResult;
|
||||
|
Reference in New Issue
Block a user