@@ -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// ----------------------------------------
816814void 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// ----------------------------------------
834830void 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