wpaspy: Add support for TERMINATE command
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Fri, 4 Mar 2016 09:20:39 +0000 (10:20 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 5 Mar 2016 15:44:51 +0000 (17:44 +0200)
This can be used to terminate the wpa_supplicant/hostapd process.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
wpaspy/wpaspy.py

index 861bee6..809b4ce 100644 (file)
@@ -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: