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>
This commit is contained in:
parent
2eef5177ad
commit
b44db5f6d6
1 changed files with 7 additions and 1 deletions
|
@ -30,7 +30,11 @@ class Ctrl:
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if self.attached:
|
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:
|
if self.started:
|
||||||
self.s.close()
|
self.s.close()
|
||||||
os.unlink(self.local)
|
os.unlink(self.local)
|
||||||
|
@ -48,6 +52,7 @@ class Ctrl:
|
||||||
return None
|
return None
|
||||||
res = self.request("ATTACH")
|
res = self.request("ATTACH")
|
||||||
if "OK" in res:
|
if "OK" in res:
|
||||||
|
self.attached = True
|
||||||
return None
|
return None
|
||||||
raise Exception("ATTACH failed")
|
raise Exception("ATTACH failed")
|
||||||
|
|
||||||
|
@ -56,6 +61,7 @@ class Ctrl:
|
||||||
return None
|
return None
|
||||||
res = self.request("DETACH")
|
res = self.request("DETACH")
|
||||||
if "OK" in res:
|
if "OK" in res:
|
||||||
|
self.attached = False
|
||||||
return None
|
return None
|
||||||
raise Exception("DETACH failed")
|
raise Exception("DETACH failed")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue