tests: Fix dump_monitor() without monitor attached
Do not try to dump pending event messages if the monitor socket has not been attached. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
808bdb308f
commit
4d916a7f3e
1 changed files with 4 additions and 3 deletions
|
@ -627,6 +627,7 @@ class WpaSupplicant:
|
||||||
else:
|
else:
|
||||||
port = self.get_ctrl_iface_port(self.group_ifname)
|
port = self.get_ctrl_iface_port(self.group_ifname)
|
||||||
self.gctrl_mon = wpaspy.Ctrl(self.hostname, port)
|
self.gctrl_mon = wpaspy.Ctrl(self.hostname, port)
|
||||||
|
if self.monitor:
|
||||||
self.gctrl_mon.attach()
|
self.gctrl_mon.attach()
|
||||||
except:
|
except:
|
||||||
logger.debug("Could not open monitor socket for group interface")
|
logger.debug("Could not open monitor socket for group interface")
|
||||||
|
@ -829,11 +830,11 @@ class WpaSupplicant:
|
||||||
def dump_monitor(self):
|
def dump_monitor(self):
|
||||||
count_iface = 0
|
count_iface = 0
|
||||||
count_global = 0
|
count_global = 0
|
||||||
while self.mon.pending():
|
while self.monitor and self.mon.pending():
|
||||||
ev = self.mon.recv()
|
ev = self.mon.recv()
|
||||||
logger.debug(self.dbg + ": " + ev)
|
logger.debug(self.dbg + ": " + ev)
|
||||||
count_iface += 1
|
count_iface += 1
|
||||||
while self.global_mon and self.global_mon.pending():
|
while self.monitor and self.global_mon and self.global_mon.pending():
|
||||||
ev = self.global_mon.recv()
|
ev = self.global_mon.recv()
|
||||||
logger.debug(self.global_dbg + self.ifname + "(global): " + ev)
|
logger.debug(self.global_dbg + self.ifname + "(global): " + ev)
|
||||||
count_global += 1
|
count_global += 1
|
||||||
|
|
Loading…
Reference in a new issue