@@ -769,21 +769,18 @@ void networkMarkOnline(NetIndex_t index)
769
769
}
770
770
771
771
// ----------------------------------------
772
- // Start multicast DNS called only from Form.ino
772
+ // Change multicast DNS to a given network
773
+ //
773
774
// ----------------------------------------
774
- void networkMulticastDNSStart ( bool startWiFi )
775
+ void networkMulticastDNSSwitch (NetIndex_t startIndex )
775
776
{
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
781
778
for (int index = 0 ; index < NETWORK_OFFLINE; index++)
782
779
if (index != startIndex)
783
780
networkMulticastDNSStop (index);
784
781
785
782
// Start mDNS on the requested network
786
- networkMulticastDNSStart (index);
783
+ networkMulticastDNSStart (startIndex); // Start DNS on the selected network, either WiFi or Ethernet
787
784
}
788
785
789
786
// ----------------------------------------
@@ -804,6 +801,7 @@ void networkMulticastDNSStart(NetIndex_t index)
804
801
{
805
802
MDNS.addService (" http" , " tcp" , settings.httpPort ); // Add service to MDNS
806
803
networkMdnsRunning |= bitMask;
804
+
807
805
if (settings.debugNetworkLayer )
808
806
systemPrintf (" mDNS started as %s.local\r\n " , settings.mdnsHostName );
809
807
}
@@ -815,10 +813,8 @@ void networkMulticastDNSStart(NetIndex_t index)
815
813
// ----------------------------------------
816
814
void networkMulticastDNSStop (NetIndex_t index)
817
815
{
818
- NetMask_t bitMask;
819
-
820
816
// Stop mDNS if it is running on this network
821
- bitMask = 1 << index;
817
+ NetMask_t bitMask = 1 << index;
822
818
if (settings.mdnsEnable && (networkMdnsRunning & bitMask))
823
819
{
824
820
MDNS.end ();
@@ -833,11 +829,8 @@ void networkMulticastDNSStop(NetIndex_t index)
833
829
// ----------------------------------------
834
830
void networkMulticastDNSStop ()
835
831
{
836
- NetMask_t bitMask;
837
- NetIndex_t startIndex;
838
-
839
832
// Determine the highest priority network
840
- startIndex = networkPriority;
833
+ NetIndex_t startIndex = networkPriority;
841
834
if (startIndex < NETWORK_OFFLINE)
842
835
startIndex = networkIndexTable[startIndex];
843
836
0 commit comments