Skip to content

Commit

Permalink
Update LEAmDNS.cpp (fix issue #6982) (#7025)
Browse files Browse the repository at this point in the history
* Update LEAmDNS.cpp (issue #6982)

Check m_pUDPContext before calling functions to reset WiFi event callbacks, stop probing ... to close #6982

* Update LEAmDNS.cpp

Co-authored-by: Earle F. Philhower, III <[email protected]>
  • Loading branch information
LeisureLadi and earlephilhower committed Jan 28, 2020
1 parent 0c6be9e commit 7b0fa35
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions libraries/ESP8266mDNS/src/LEAmDNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,26 @@ bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress
*/
bool MDNSResponder::close(void)
{
bool bResult = false;

m_GotIPHandler.reset(); // reset WiFi event callbacks.
m_DisconnectedHandler.reset();
if (0 != m_pUDPContext)
{
m_GotIPHandler.reset(); // reset WiFi event callbacks.
m_DisconnectedHandler.reset();

_announce(false, true);
_resetProbeStatus(false); // Stop probing
_announce(false, true);
_resetProbeStatus(false); // Stop probing
_releaseServiceQueries();
_releaseUDPContext();
_releaseHostname();

_releaseServiceQueries();
_releaseUDPContext();
_releaseHostname();

return true;
bResult = true;
}
else
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] close: Ignoring call to close!\n")););
}
return bResult;
}

/*
Expand Down

0 comments on commit 7b0fa35

Please sign in to comment.