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

mDNS: restriction to a single interface (#6224)

Default interface is STA (or AP if available and STA is unavailable).
An interface can also be specified in ::begin() by its IP address.
MDNS will not cross interfaces (there is currently no notion of "bridged interfaces")

Multiple instances should be working, this is not tested in this commit.
This commit is contained in:
david gauchard
2019-06-27 09:30:12 +02:00
committed by GitHub
parent 5306976db1
commit f9009b8a5e
6 changed files with 85 additions and 104 deletions

View File

@ -87,12 +87,15 @@ MDNSResponder::~MDNSResponder(void) {
* Finally the responder is (re)started
*
*/
bool MDNSResponder::begin(const char* p_pcHostname) {
bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress, uint32_t p_u32TTL) {
(void)p_u32TTL; // ignored
bool bResult = false;
if (0 == m_pUDPContext) {
if (_setHostname(p_pcHostname)) {
m_IPAddress = p_IPAddress;
m_GotIPHandler = WiFi.onStationModeGotIP([this](const WiFiEventStationModeGotIP& pEvent) {
(void) pEvent;
@ -116,18 +119,6 @@ bool MDNSResponder::begin(const char* p_pcHostname) {
return bResult;
}
/*
* MDNSResponder::begin (LEGACY)
*/
bool MDNSResponder::begin(const char* p_pcHostname,
IPAddress p_IPAddress,
uint32_t p_u32TTL /*= 120*/) {
(void) p_IPAddress;
(void) p_u32TTL;
return begin(p_pcHostname);
}
/*
* MDNSResponder::close
*