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 GitHub
parent cf9c6e5cc8
commit ccba27cedd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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)
}
},
})