chore(mDNS): ensure the mDNS mode is set every time network state changes (#624)

Eliminates (mostly) duplicate code
This commit is contained in:
Marc Brooks 2025-06-19 02:29:21 -05:00 committed by Siyuan
parent f87a74e23a
commit 4a4e1c0f7d
1 changed files with 1 additions and 8 deletions

View File

@ -21,6 +21,7 @@ func networkStateChanged() {
// always restart mDNS when the network state changes
if mDNS != nil {
_ = mDNS.SetListenOptions(config.NetworkConfig.GetMDNSMode())
_ = mDNS.SetLocalNames([]string{
networkState.GetHostname(),
networkState.GetFQDN(),
@ -54,14 +55,6 @@ func initNetwork() error {
OnConfigChange: func(networkConfig *network.NetworkConfig) {
config.NetworkConfig = networkConfig
networkStateChanged()
if mDNS != nil {
_ = mDNS.SetListenOptions(networkConfig.GetMDNSMode())
_ = mDNS.SetLocalNames([]string{
networkState.GetHostname(),
networkState.GetFQDN(),
}, true)
}
},
})