Skip to content

Commit a8515a7

Browse files
authored
use STA as default interface in mDNS (#7042)
1 parent 14f6272 commit a8515a7

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

libraries/ESP8266mDNS/src/LEAmDNS.cpp

+7-20
Original file line numberDiff line numberDiff line change
@@ -114,33 +114,20 @@ bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress
114114
IPAddress sta = WiFi.localIP();
115115
IPAddress ap = WiFi.softAPIP();
116116

117-
if (!sta.isSet() && !ap.isSet())
117+
if (sta.isSet())
118118
{
119-
120-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] internal interfaces (STA, AP) are not set (none was specified)\n")));
121-
return false;
119+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] STA interface selected\n")));
120+
ipAddress = sta;
122121
}
123-
124-
if (ap.isSet())
122+
else if (ap.isSet())
125123
{
126-
127-
if (sta.isSet())
128-
{
129-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected over STA (none was specified)\n")));
130-
}
131-
else
132-
{
133-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected\n")));
134-
}
124+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] AP interface selected\n")));
135125
ipAddress = ap;
136-
137126
}
138127
else
139128
{
140-
141-
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface STA selected (none was specified)\n")));
142-
ipAddress = sta;
143-
129+
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] standard interfaces are not up, please specify one in ::begin()\n")));
130+
return false;
144131
}
145132

146133
// continue to ensure interface is UP

0 commit comments

Comments
 (0)