Skip to content

Commit dd58d62

Browse files
committed
Make Web Config work again
networkMulticastDNSStart(index) was ambiguous causing networkMulticastDNSStart(bool startWiFi) to be recursively called. Changing function name to be more explicit and fixing recursion.
1 parent 91c0779 commit dd58d62

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

Firmware/RTK_Everywhere/Form.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ bool startWebServer(bool startWiFi = true, int httpPort = 80)
265265
break;
266266

267267
// Start the multicast DNS server
268-
networkMulticastDNSStart(startWiFi);
268+
if (startWiFi == true)
269+
networkMulticastDNSSwitch(NETWORK_WIFI);
270+
else
271+
networkMulticastDNSSwitch(NETWORK_ETHERNET);
269272

270273
// Freed by stopWebServer
271274
if (online.psram == true)

Firmware/RTK_Everywhere/Network.ino

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -769,21 +769,18 @@ void networkMarkOnline(NetIndex_t index)
769769
}
770770

771771
//----------------------------------------
772-
// Start multicast DNS called only from Form.ino
772+
// Change multicast DNS to a given network
773+
//
773774
//----------------------------------------
774-
void networkMulticastDNSStart(bool startWiFi)
775+
void networkMulticastDNSSwitch(NetIndex_t startIndex)
775776
{
776-
NetMask_t bitMask;
777-
NetIndex_t startIndex;
778-
779-
// Stop mDNS on other networks
780-
startIndex = startWiFi ? NETWORK_WIFI : NETWORK_ETHERNET;
777+
// Stop mDNS on the other networks
781778
for (int index = 0; index < NETWORK_OFFLINE; index++)
782779
if (index != startIndex)
783780
networkMulticastDNSStop(index);
784781

785782
// Start mDNS on the requested network
786-
networkMulticastDNSStart(index);
783+
networkMulticastDNSStart(startIndex); //Start DNS on the selected network, either WiFi or Ethernet
787784
}
788785

789786
//----------------------------------------
@@ -804,6 +801,7 @@ void networkMulticastDNSStart(NetIndex_t index)
804801
{
805802
MDNS.addService("http", "tcp", settings.httpPort); // Add service to MDNS
806803
networkMdnsRunning |= bitMask;
804+
807805
if (settings.debugNetworkLayer)
808806
systemPrintf("mDNS started as %s.local\r\n", settings.mdnsHostName);
809807
}
@@ -815,10 +813,8 @@ void networkMulticastDNSStart(NetIndex_t index)
815813
//----------------------------------------
816814
void networkMulticastDNSStop(NetIndex_t index)
817815
{
818-
NetMask_t bitMask;
819-
820816
// Stop mDNS if it is running on this network
821-
bitMask = 1 << index;
817+
NetMask_t bitMask = 1 << index;
822818
if (settings.mdnsEnable && (networkMdnsRunning & bitMask))
823819
{
824820
MDNS.end();
@@ -833,11 +829,8 @@ void networkMulticastDNSStop(NetIndex_t index)
833829
//----------------------------------------
834830
void networkMulticastDNSStop()
835831
{
836-
NetMask_t bitMask;
837-
NetIndex_t startIndex;
838-
839832
// Determine the highest priority network
840-
startIndex = networkPriority;
833+
NetIndex_t startIndex = networkPriority;
841834
if (startIndex < NETWORK_OFFLINE)
842835
startIndex = networkIndexTable[startIndex];
843836

0 commit comments

Comments
 (0)