eric7/EricNetwork/EricJsonStreamReader.py

branch
unittest
changeset 9090
224c634a1808
parent 9062
7f27bf3b50c3
child 9192
a763d57e23bc
--- a/eric7/EricNetwork/EricJsonStreamReader.py	Mon May 23 16:48:19 2022 +0200
+++ b/eric7/EricNetwork/EricJsonStreamReader.py	Mon May 23 16:49:08 2022 +0200
@@ -105,6 +105,7 @@
         Private slot handling a disconnect of the writer.
         """
         if self.__connection is not None:
+            self.__receiveJson()    # read all buffered data first
             self.__connection.close()
         
         self.__connection = None
@@ -114,10 +115,8 @@
         """
         Private slot handling received data from the writer.
         """
-        connection = self.__connection
-        
-        while connection and connection.canReadLine():
-            dataStr = connection.readLine()
+        while self.__connection and self.__connection.canReadLine():
+            dataStr = self.__connection.readLine()
             jsonLine = bytes(dataStr).decode("utf-8", 'backslashreplace')
             
             #- print("JSON Reader ({0}): {1}".format(self.__name, jsonLine))

eric ide

mercurial