mirror of https://github.com/jetkvm/kvm.git
chore(mDNS): ensure the mDNS mode is set every time network state changes (#624)
Eliminates (mostly) duplicate code
This commit is contained in:
parent
cf9c6e5cc8
commit
ccba27cedd
|
@ -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)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue