3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-26 09:32:34 +01:00

auto-t: hostapd.py: remove ungraceful_restart

This is no longer needed and greatly simplifies the class
This commit is contained in:
James Prestwood 2021-08-23 11:32:21 -07:00 committed by Denis Kenzior
parent 5776ce87d7
commit 70b6451dc2

View File

@ -43,10 +43,10 @@ class HostapdCLI(object):
return cls._instances[config]
def _init_hostapd(self, config, reinit=False):
def __init__(self, config=None, *args, **kwargs):
global ctrl_count
if self._initialized and not reinit:
if self._initialized:
return
self._initialized = True
@ -83,9 +83,6 @@ class HostapdCLI(object):
ctrl_count = ctrl_count + 1
def __init__(self, config=None, *args, **kwargs):
self._init_hostapd(config)
def _poll_event(self, event):
if not self._data_available(0.25):
return False
@ -117,20 +114,15 @@ class HostapdCLI(object):
return self.ctrl_sock.recv(4096).decode('utf-8')
def _del_hostapd(self, force=False):
if not self.ctrl_sock:
return
self.ctrl_sock.close()
def __del__(self):
if self.ctrl_sock:
self.ctrl_sock.close()
try:
os.remove(self.local_ctrl)
except:
pass
def __del__(self):
self._del_hostapd()
HostapdCLI._instances[self.config] = None
# Check if this is the final instance
@ -202,25 +194,6 @@ class HostapdCLI(object):
if 'OK' not in proc.out:
raise Exception('BSS_TM_REQ failed, is hostapd built with CONFIG_WNM_AP=y?')
def ungraceful_restart(self):
'''
Ungracefully kill and restart hostapd
'''
ctx.stop_process(ctx.hostapd.process, True)
self.interface.set_interface_state('down')
self.interface.set_interface_state('up')
self._del_hostapd(force=True)
ctx.start_hostapd()
# Give hostapd a second to start and initialize the control interface
time.sleep(1)
# New hostapd process, so re-init
self._init_hostapd(config=self.config, reinit=True)
def req_beacon(self, addr, request):
'''
Send a RRM Beacon request