mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Properly exit ReaderThread on socket shutdown. Fixes #1942
This commit is contained in:
parent
d8d0eba519
commit
5d674c49e5
1 changed files with 6 additions and 4 deletions
|
|
@ -285,14 +285,15 @@ class ReaderThread(PyDBDaemonThread):
|
|||
# processing anything read).
|
||||
try:
|
||||
line = self._read_line()
|
||||
if self._kill_received:
|
||||
continue
|
||||
|
||||
if len(line) == 0:
|
||||
pydev_log.debug('ReaderThread: empty contents received (len(line) == 0).')
|
||||
self._terminate_on_socket_close()
|
||||
return # Finished communication.
|
||||
|
||||
if self._kill_received:
|
||||
continue
|
||||
|
||||
if line.startswith(b'Content-Length:'):
|
||||
content_len = int(line.strip().split(b':', 1)[1])
|
||||
continue
|
||||
|
|
@ -301,8 +302,6 @@ class ReaderThread(PyDBDaemonThread):
|
|||
# If we previously received a content length, read until a '\r\n'.
|
||||
if line == b'\r\n':
|
||||
json_contents = self._read(content_len)
|
||||
if self._kill_received:
|
||||
continue
|
||||
|
||||
content_len = -1
|
||||
|
||||
|
|
@ -311,6 +310,9 @@ class ReaderThread(PyDBDaemonThread):
|
|||
self._terminate_on_socket_close()
|
||||
return # Finished communication.
|
||||
|
||||
if self._kill_received:
|
||||
continue
|
||||
|
||||
# We just received a json message, let's process it.
|
||||
self.process_net_command_json(self.py_db, json_contents)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue