File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
libraries/ESP8266mDNS/src Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 2222 *
2323 */
2424
25+ #include < Schedule.h>
26+
2527#include " LEAmDNS_Priv.h"
2628
29+
2730namespace esp8266 {
2831
2932/*
@@ -87,28 +90,30 @@ MDNSResponder::~MDNSResponder(void) {
8790 */
8891bool MDNSResponder::begin (const char * p_pcHostname) {
8992
90- bool bResult = ( 0 != m_pcHostname) ;
93+ bool bResult = false ;
9194
92- if (0 == m_pcHostname ) {
95+ if (0 == m_pUDPContext ) {
9396 if (_setHostname (p_pcHostname)) {
9497
9598 m_GotIPHandler = WiFi.onStationModeGotIP ([this ](const WiFiEventStationModeGotIP& pEvent) {
9699 (void ) pEvent;
97- _restart ();
100+ // Ensure that _restart() runs in USER context
101+ schedule_function (std::bind (&MDNSResponder::_restart, this ));
98102 });
99103
100104 m_DisconnectedHandler = WiFi.onStationModeDisconnected ([this ](const WiFiEventStationModeDisconnected& pEvent) {
101105 (void ) pEvent;
102- _restart ();
106+ // Ensure that _restart() runs in USER context
107+ schedule_function (std::bind (&MDNSResponder::_restart, this ));
103108 });
104109
105110 bResult = _restart ();
106111 }
112+ DEBUG_EX_ERR (if (!bResult) { DEBUG_OUTPUT.printf_P (PSTR (" [MDNSResponder] begin: FAILED for '%s'!\n " ), (p_pcHostname ?: " -" )); } );
107113 }
108114 else {
109- DEBUG_EX_INFO (DEBUG_OUTPUT.printf_P (PSTR (" [MDNSResponder] begin: Ignoring multiple calls (Ignored host domain: '%s')!\n " ), (p_pcHostname ?: " -" )););
115+ DEBUG_EX_INFO (DEBUG_OUTPUT.printf_P (PSTR (" [MDNSResponder] begin: Ignoring multiple calls to begin (Ignored host domain: '%s')!\n " ), (p_pcHostname ?: " -" )););
110116 }
111- DEBUG_EX_ERR (if (!bResult) { DEBUG_OUTPUT.printf_P (PSTR (" [MDNSResponder] begin: FAILED for '%s'!\n " ), (p_pcHostname ?: " -" )); } );
112117 return bResult;
113118}
114119
You can’t perform that action at this time.
0 commit comments