wpaspy: Be a bit more careful on detaching the control interface

Check that the client socket is still open before trying to detach the
control interface to avoid undesired exceptions on cleanup paths on
unexpected errors due to the socket getting closed.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-06-01 22:24:00 +03:00 committed by Jouni Malinen
parent 8019033fc5
commit 30885edb7e

View file

@ -113,6 +113,9 @@ class Ctrl:
def detach(self): def detach(self):
if not self.attached: if not self.attached:
return None return None
if self.s.fileno() == -1:
self.attached = False
return None
while self.pending(): while self.pending():
ev = self.recv() ev = self.recv()
res = self.request("DETACH") res = self.request("DETACH")