just loop and write responses
(self)
| 381 | |
| 382 | @overrides(PyDBDaemonThread._on_run) |
| 383 | def _on_run(self): |
| 384 | """just loop and write responses""" |
| 385 | |
| 386 | try: |
| 387 | while True: |
| 388 | try: |
| 389 | try: |
| 390 | cmd = self._cmd_queue.get(True, 0.1) |
| 391 | except _queue.Empty: |
| 392 | if self._kill_received: |
| 393 | pydev_log.debug("WriterThread: kill_received (sock.shutdown(SHUT_WR))") |
| 394 | try: |
| 395 | self.sock.shutdown(SHUT_WR) |
| 396 | except: |
| 397 | pass |
| 398 | # Note: don't close the socket, just send the shutdown, |
| 399 | # then, when no data is received on the reader, it can close |
| 400 | # the socket. |
| 401 | # See: https://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable |
| 402 | |
| 403 | # try: |
| 404 | # self.sock.close() |
| 405 | # except: |
| 406 | # pass |
| 407 | |
| 408 | return # break if queue is empty and _kill_received |
| 409 | else: |
| 410 | continue |
| 411 | except: |
| 412 | # pydev_log.info('Finishing debug communication...(1)') |
| 413 | # when liberating the thread here, we could have errors because we were shutting down |
| 414 | # but the thread was still not liberated |
| 415 | return |
| 416 | |
| 417 | if cmd.as_dict is not None: |
| 418 | for listener in self.py_db.dap_messages_listeners: |
| 419 | listener.before_send(cmd.as_dict) |
| 420 | |
| 421 | notify_about_gevent_if_needed() |
| 422 | cmd.send(self.sock) |
| 423 | |
| 424 | if cmd.id == CMD_EXIT: |
| 425 | pydev_log.debug("WriterThread: CMD_EXIT received") |
| 426 | break |
| 427 | if time is None: |
| 428 | break # interpreter shutdown |
| 429 | time.sleep(self.timeout) |
| 430 | except Exception: |
| 431 | if self.__terminate_on_socket_close: |
| 432 | self.py_db.dispose_and_kill_all_pydevd_threads() |
| 433 | if DebugInfoHolder.DEBUG_TRACE_LEVEL > 0: |
| 434 | pydev_log_exception() |
| 435 | finally: |
| 436 | pydev_log.debug("WriterThread: exit") |
| 437 | |
| 438 | def empty(self): |
| 439 | return self._cmd_queue.empty() |
nothing calls this directly
no test coverage detected