def close(self): """Stop the message processor and release its resources.""" if self.closed: return self._closing = True ptvsd.log.debug('Raw closing') self._notify_closing() # Close the editor-side socket. self._stop_vsc_message_loop() # Ensure that the connection is marked as closed. with self._connlock: _util.lock_release(self._listening) _util.lock_release(self._connected) self._closed = True
def handle_exiting(self, exitcode=None, wait=None): """Deal with the debuggee exiting.""" with self._statelock: if self._exiting: return self._exiting = True # Notify the editor that the "debuggee" (e.g. script, app) exited. self.send_event('exited', exitCode=exitcode or 0) self._waiting = True if wait is not None and self.start_reason == 'launch': normal, abnormal = self._wait_options() cfg = (normal and not exitcode) or (abnormal and exitcode) # This must be done before we send a disconnect response # (which implies before we close the client socket). wait(cfg) # If we are exiting then pydevd must have stopped. self._ensure_debugger_stopped() if self._exitlock is not None: _util.lock_release(self._exitlock)
def process_messages(): self.readylock.acquire() with self._connlock: self._listening = threading.Lock() try: self.process_messages() except (EOFError, TimeoutError): ptvsd.log.exception('Client socket closed', category='I') with self._connlock: _util.lock_release(self._listening) _util.lock_release(self._connected) self.close() except socket.error as exc: if exc.errno == errno.ECONNRESET: ptvsd.log.exception('Client socket forcibly closed', category='I') with self._connlock: _util.lock_release(self._listening) _util.lock_release(self._connected) self.close() else: raise exc
def _set_disconnected(self): with self._connlock: _util.lock_release(self._connected)