1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-27 21:16:50 +03:00

use STA as default interface in mDNS (#7042)

This commit is contained in:
david gauchard 2020-02-05 10:14:42 +01:00 committed by GitHub
parent 14f627218b
commit a8515a7d66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,33 +114,20 @@ bool MDNSResponder::begin(const char* p_pcHostname, const IPAddress& p_IPAddress
IPAddress sta = WiFi.localIP(); IPAddress sta = WiFi.localIP();
IPAddress ap = WiFi.softAPIP(); IPAddress ap = WiFi.softAPIP();
if (!sta.isSet() && !ap.isSet()) if (sta.isSet())
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] STA interface selected\n")));
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] internal interfaces (STA, AP) are not set (none was specified)\n"))); ipAddress = sta;
return false;
} }
else if (ap.isSet())
if (ap.isSet())
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] AP interface selected\n")));
if (sta.isSet())
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected over STA (none was specified)\n")));
}
else
{
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface AP selected\n")));
}
ipAddress = ap; ipAddress = ap;
} }
else else
{ {
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] standard interfaces are not up, please specify one in ::begin()\n")));
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] default interface STA selected (none was specified)\n"))); return false;
ipAddress = sta;
} }
// continue to ensure interface is UP // continue to ensure interface is UP