SEDbgMuxApp: properly handle peer.recv() returning None

In 2990cc14b8 I introduced a regression,
which affects the 'establish' command: if no data is received from a
Data Provider during 500 ms, the application crashes:

    File "sedbgmux.py", line 151, in do_establish
      if f['MsgType'] != DbgMuxFrame.MsgType.ConnData:
  TypeError: 'NoneType' object is not subscriptable

This is happening because peer.recv() is returning None.
master
Vadim Yanitskiy 3 months ago
parent 2990cc14b8
commit 530975eff2
  1. 3
      sedbgmux.py

@ -147,7 +147,8 @@ class SEDbgMuxApp(cmd2.Cmd):
# Read the messages
while True:
f = self.peer.recv()
if f is None:
continue # No more data in the buffer
if f['MsgType'] != DbgMuxFrame.MsgType.ConnData:
log.warning('Unexpected frame: %s', f)
self.peer.send(DbgMuxFrame.MsgType.Ack)

Loading…
Cancel
Save