diff --git a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py index a00227dd..037aefbc 100644 --- a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py +++ b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py @@ -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)