RefactoringRope/JsonServer.py

branch
server_client_variant
changeset 195
5d614a567be3
parent 194
5c297b473425
child 197
7046ac1bcb4b
diff -r 5c297b473425 -r 5d614a567be3 RefactoringRope/JsonServer.py
--- a/RefactoringRope/JsonServer.py	Sun Sep 24 19:36:17 2017 +0200
+++ b/RefactoringRope/JsonServer.py	Mon Sep 25 20:08:59 2017 +0200
@@ -73,10 +73,10 @@
             if not connection.waitForReadyRead(3000):
                 return
             idString = bytes(connection.readLine()).decode(
-                "utf-8", 'backslashreplace')
+                "utf-8", 'backslashreplace').strip()
             if idString in self.__connections:
-                self.__connections[id].close()
-                self.__connections[id] = connection
+                self.__connections[idString].close()
+            self.__connections[idString] = connection
         else:
             idString = ""
             if self.__connection is not None:
@@ -107,6 +107,17 @@
             
             self.__connection = None
     
+    def connectionNames(self):
+        """
+        Public method to get the list of active connection names.
+        
+        If this is not a multiplexing server, an empty list is returned.
+        
+        @return list of active connection names
+        @rtype list of str
+        """
+        return list(self.__connections.keys())
+    
     @pyqtSlot()
     def __receiveJson(self, idString):
         """
@@ -198,6 +209,8 @@
         proc = QProcess()
         proc.setProcessChannelMode(QProcess.ForwardedChannels)
         args = [clientScript, self.__hostAddress, str(self.serverPort())]
+        if idString:
+            args.append(idString)
         args.extend(clientArgs)
         proc.start(interpreter, args)
         if not proc.waitForStarted(10000):

eric ide

mercurial