Skip to content

Commit

Permalink
Ensure a single bad message does not cause a thread exception
Browse files Browse the repository at this point in the history
If a single message cannot be parsed and throws, the whole
thread would collapse and no more messages would be parsed
see exception in andreikop#82
  • Loading branch information
bdraco committed Jan 23, 2025
1 parent ef63be8 commit fe8143a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wsdiscovery/threaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ def _recvMessages(self):
time.sleep(0.01)
continue

env = parseSOAPMessage(data, addr[0])
try:
env = parseSOAPMessage(data, addr[0])
except Exception as e:
logger.debug("Failed to parse message from %s\n%s: %s", addr[0], data, e, exc_info=True)
env = None

if env is None: # fault or failed to parse
if self._capture:
Expand Down

0 comments on commit fe8143a

Please sign in to comment.