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>
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)
return None
res = self.request("ATTACH")
if "OK" in res:
+ self.attached = True
return None
raise Exception("ATTACH failed")
return None
res = self.request("DETACH")
if "OK" in res:
+ self.attached = False
return None
raise Exception("DETACH failed")