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: