RefactoringRope/JsonServer.py

branch
server_client_variant
changeset 197
7046ac1bcb4b
parent 195
5d614a567be3
child 203
c38750e1bafd
--- a/RefactoringRope/JsonServer.py	Tue Sep 26 18:47:50 2017 +0200
+++ b/RefactoringRope/JsonServer.py	Tue Sep 26 19:05:18 2017 +0200
@@ -24,10 +24,12 @@
     """
     Class implementing the JSON based server base class.
     """
-    def __init__(self, multiplex=False, parent=None):
+    def __init__(self, name="", multiplex=False, parent=None):
         """
         Constructor
         
+        @param name name of the server (used for output only)
+        @type str
         @param multiplex flag indicating a multiplexing server
         @type bool
         @param parent parent object
@@ -57,7 +59,7 @@
         
         port = self.serverPort()
         ## Note: Need the port if started external in debugger:
-        print('Refactoring server listening on: {0:d}'.format(port))
+        print('JSON server ({1}) listening on: {0:d}'.format(port, name))
         # __IGNORE_WARNING__
     
     @pyqtSlot()
@@ -100,7 +102,7 @@
         if idString:
             if idString in self.__connections:
                 self.__connections[idString].close()
-                del self.__connections[id]
+                del self.__connections[idString]
         else:
             if self.__connection is not None:
                 self.__connection.close()
@@ -247,6 +249,14 @@
                 self.__clientProcess.close()
                 self.__clientProcess = None
     
+    def stopAllClients(self):
+        """
+        Public method to stop all clients.
+        """
+        clientNames = self.connectionNames()[:]
+        for clientName in clientNames:
+            self.stopClient(clientName)
+    
     #######################################################################
     ## The following methods should be overridden by derived classes
     #######################################################################

eric ide

mercurial