MCPcopy Create free account
hub / github.com/microsoft/debugpy / disconnect_request

Method disconnect_request

src/debugpy/adapter/clients.py:683–709  ·  view source on GitHub ↗
(self, request)

Source from the content-addressed store, hash-verified

681
682 @message_handler
683 def disconnect_request(self, request):
684 # If user specifically requests to disconnect, it means that they don't want
685 # debug session auto-restart kicking in.
686 self.restart_requested = False
687
688 terminate_debuggee = request("terminateDebuggee", bool, optional=True)
689 if terminate_debuggee == ():
690 terminate_debuggee = None
691 self.session.finalize('client requested "disconnect"', terminate_debuggee)
692 request.respond({})
693
694 if self.using_stdio:
695 # There's no way for the client to reconnect to this adapter once it disconnects
696 # from this session, so close any remaining server connections.
697 servers.stop_serving()
698 log.info("{0} disconnected from stdio; closing remaining server connections.", self)
699 for conn in servers.connections():
700 try:
701 conn.channel.close()
702 except Exception:
703 log.swallow_exception()
704
705 # Close the client channel since we disconnected from the client.
706 try:
707 self.channel.close()
708 except Exception:
709 log.swallow_exception(level="warning")
710
711 def disconnect(self):
712 super().disconnect()

Callers

nothing calls this directly

Calls 4

respondMethod · 0.80
infoMethod · 0.80
finalizeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected