src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py

branch
eric7
changeset 10965
f80b241605c9
parent 10962
b56b76c0221b
child 11000
f8371a2dd08f
diff -r 3ce89f2d4729 -r f80b241605c9 src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py
--- a/src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py	Thu Oct 10 17:21:46 2024 +0200
+++ b/src/eric7/RemoteServer/EricServerDebuggerRequestHandler.py	Thu Oct 10 19:59:49 2024 +0200
@@ -165,6 +165,9 @@
                     if not self._server.isSocketClosed(sock):
                         self.__clientSocketDisconnected(sock)
 
+                if data["params"]["debuggerId"] == self.__mainClientId:
+                    self.__mainClientExited()
+
     def __clientSocketDisconnected(self, sock):
         """
         Private method handling a socket disconnecting.
@@ -202,6 +205,10 @@
         with contextlib.suppress(OSError):
             sock.close()
 
+        if not self.__connections:
+            # no active connections anymore
+            self.__lastClientExited()
+
     def __mainClientExited(self):
         """
         Private method to handle exiting of the main debug client.
@@ -212,6 +219,16 @@
             params={"debugger_id": self.__mainClientId if self.__mainClientId else ""},
         )
 
+    def __lastClientExited(self):
+        """
+        Private method to handle exiting of the last debug client.
+        """
+        self._server.sendJson(
+            category=EricRequestCategory.Debugger,
+            reply="LastDebugClientExited",
+            params={},
+        )
+
     def shutdownClients(self):
         """
         Public method to shut down all connected clients.

eric ide

mercurial