Moved disconnect fix from messaging to Client.disconnect_request

This commit is contained in:
Matej Aleksandrov 2025-03-07 12:57:54 +00:00
parent cc6b2499b2
commit d937dff0fd
2 changed files with 6 additions and 8 deletions

View file

@ -700,6 +700,12 @@ class Client(components.Component):
except Exception:
log.swallow_exception()
# Close the client channel since we disconnected from the client.
try:
self.channel.close()
except Exception:
log.swallow_exception(level="warning")
def disconnect(self):
super().disconnect()

View file

@ -1223,14 +1223,6 @@ class JsonMessageChannel(object):
yield seq
self.stream.write_json(message)
# Close connection after Debugpy acknowledges a disconnect request.
if (
message.get("type") == "response"
and message.get("command") == "disconnect"
and message.get("success", False)
):
self.stream.close()
def send_request(self, command, arguments=None, on_before_send=None):
"""Sends a new request, and returns the OutgoingRequest object for it.