Skip to content

Commit

Permalink
Fix uncatched RuntimeError throwed when socket error while receiving …
Browse files Browse the repository at this point in the history
…packet

afpacket.recv will throw RuntimeError when sniffed interface had link flipped.
IfaceMgr doesn't catch the RuntimeError causing thread exit the main loop, thus can't receive packet anymore.
  • Loading branch information
linarnan authored and antoninbas committed Feb 11, 2021
1 parent c221d0c commit b2978be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ptf_nn/ptf_nn_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def run(self):
while True:
msg = afpacket.recv(self.socket, 4096)
self.received(msg)
except socket.error as err:
except (socket.error, RuntimeError) as err:
logger.debug("IfaceMgr {}-{} ({}) Error reading from the socket.".format(
self.dev, self.port, self.iface_name))
self.socket.close()
Expand Down

0 comments on commit b2978be

Please sign in to comment.