From: Janusz Dziedzic Date: Fri, 4 Mar 2016 09:20:39 +0000 (+0100) Subject: wpaspy: Add support for TERMINATE command X-Git-Tag: hostap_2_6~739 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13073011b98ab0a7e8c273c5bfdb6b7d75a4f8ca;p=thirdparty%2Fhostap.git wpaspy: Add support for TERMINATE command This can be used to terminate the wpa_supplicant/hostapd process. Signed-off-by: Janusz Dziedzic --- diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 861bee6ee..809b4ce00 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -109,6 +109,16 @@ class Ctrl: return None raise Exception("DETACH failed") + def terminate(self): + if self.attached: + try: + self.detach() + except Exception, e: + # Need to ignore this to allow the socket to be closed + self.attached = False + self.request("TERMINATE") + self.close() + def pending(self, timeout=0): [r, w, e] = select.select([self.s], [], [], timeout) if r: