From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 3/3] auto-t: hostapd.py: remove ungraceful_restart
Date: Mon, 23 Aug 2021 11:32:21 -0700 [thread overview]
Message-ID: <20210823183221.558154-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20210823183221.558154-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2476 bytes --]
This is no longer needed and greatly simplifies the class
---
autotests/util/hostapd.py | 37 +++++--------------------------------
1 file changed, 5 insertions(+), 32 deletions(-)
diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py
index 8b81d467..2dcf38f9 100644
--- a/autotests/util/hostapd.py
+++ b/autotests/util/hostapd.py
@@ -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
--
2.31.1
next prev parent reply other threads:[~2021-08-23 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 18:32 [PATCH 1/3] auto-t: hwsim.py: convert addresses to 42:* format James Prestwood
2021-08-23 18:32 ` [PATCH 2/3] auto-t: testSAQuery remove ungraceful restart James Prestwood
2021-08-23 18:32 ` James Prestwood [this message]
2021-08-25 13:52 ` [PATCH 1/3] auto-t: hwsim.py: convert addresses to 42:* format Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210823183221.558154-3-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox