aboutsummaryrefslogtreecommitdiffstats
path: root/wpaspy
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-12-30 20:23:18 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-31 07:29:14 (GMT)
commitb44db5f6d6698fe7cf7f603e3f99cfe169a8706d (patch)
tree2ebe609492e27f081f2d8f308ee78a8cf31f191b /wpaspy
parent2eef5177adbf8d14c800fba90f7fb0ccce36db6d (diff)
downloadhostap-b44db5f6d6698fe7cf7f603e3f99cfe169a8706d.zip
hostap-b44db5f6d6698fe7cf7f603e3f99cfe169a8706d.tar.gz
hostap-b44db5f6d6698fe7cf7f603e3f99cfe169a8706d.tar.bz2
wpaspy: Fix tracking of attached status
The attached variable was initialized and checked, but never updated. Fix that by updating it on successful ATTACH/DETACH command. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpaspy')
-rw-r--r--wpaspy/wpaspy.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py
index 678695f..9836c2d 100644
--- a/wpaspy/wpaspy.py
+++ b/wpaspy/wpaspy.py
@@ -30,7 +30,11 @@ class Ctrl:
def close(self):
if self.attached:
- self.detach()
+ try:
+ self.detach()
+ except Exception, e:
+ # Need to ignore this allow the socket to be closed
+ pass
if self.started:
self.s.close()
os.unlink(self.local)
@@ -48,6 +52,7 @@ class Ctrl:
return None
res = self.request("ATTACH")
if "OK" in res:
+ self.attached = True
return None
raise Exception("ATTACH failed")
@@ -56,6 +61,7 @@ class Ctrl:
return None
res = self.request("DETACH")
if "OK" in res:
+ self.attached = False
return None
raise Exception("DETACH failed")