Skip to content

Commit ccba27c

Browse files
authored
chore(mDNS): ensure the mDNS mode is set every time network state changes (#624)
Eliminates (mostly) duplicate code
1 parent cf9c6e5 commit ccba27c

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

network.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func networkStateChanged() {
2121

2222
// always restart mDNS when the network state changes
2323
if mDNS != nil {
24+
_ = mDNS.SetListenOptions(config.NetworkConfig.GetMDNSMode())
2425
_ = mDNS.SetLocalNames([]string{
2526
networkState.GetHostname(),
2627
networkState.GetFQDN(),
@@ -54,14 +55,6 @@ func initNetwork() error {
5455
OnConfigChange: func(networkConfig *network.NetworkConfig) {
5556
config.NetworkConfig = networkConfig
5657
networkStateChanged()
57-
58-
if mDNS != nil {
59-
_ = mDNS.SetListenOptions(networkConfig.GetMDNSMode())
60-
_ = mDNS.SetLocalNames([]string{
61-
networkState.GetHostname(),
62-
networkState.GetFQDN(),
63-
}, true)
64-
}
6558
},
6659
})
6760

0 commit comments

Comments
 (0)