File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1717from typing import TYPE_CHECKING , Dict , List , Optional
1818
1919import dbus
20+ import socket
2021
2122from comitup import config , nm
2223
@@ -190,6 +191,22 @@ def add_hosts(hosts: List[str]) -> None:
190191 group .Commit ()
191192
192193
194+ def check_mdns (hosts : List [str ]) -> None :
195+ reset = False
196+
197+ log .debug ("Checking mdns" )
198+
199+ try :
200+ socket .gethostbyname (hosts [0 ])
201+ except socket .gaierror :
202+ reset = True
203+
204+ if reset :
205+ log .error ("Mdns check failed - resetting records and services." )
206+ clear_entries (emphatic = True )
207+ add_hosts (* hosts )
208+
209+
193210if __name__ == "__main__" :
194211 add_hosts (["comitup-1111.local" , "comitup.local" ])
195212
Original file line number Diff line number Diff line change @@ -296,6 +296,8 @@ def connected_timeout(dummy: int) -> None:
296296 log .error ("AP is holding default route while CONNECTED, kicking" )
297297 nm .disconnect (link_dev )
298298
299+ mdns .check_mdns (dns_names )
300+
299301
300302#
301303# State Management
You can’t perform that action at this time.
0 commit comments