Skip to content

Commit fe8143a

Browse files
committed
Ensure a single bad message does not cause a thread exception
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
1 parent ef63be8 commit fe8143a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wsdiscovery/threaded.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ def _recvMessages(self):
195195
time.sleep(0.01)
196196
continue
197197

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

200204
if env is None: # fault or failed to parse
201205
if self._capture:

0 commit comments

Comments
 (0)