src/eric7/Debugger/DebuggerInterfacePython.py

branch
server
changeset 10704
27d21e5163b8
parent 10680
306373ccf8fd
parent 10697
8a609e4c71b6
child 10761
63618ecdbe57
diff -r 306373ccf8fd -r 27d21e5163b8 src/eric7/Debugger/DebuggerInterfacePython.py
--- a/src/eric7/Debugger/DebuggerInterfacePython.py	Wed Apr 10 17:03:56 2024 +0200
+++ b/src/eric7/Debugger/DebuggerInterfacePython.py	Wed May 15 10:45:50 2024 +0200
@@ -107,6 +107,7 @@
         @type str
         @param remote2local flag indicating the direction of translation
             (False = local to remote, True = remote to local) (defaults to True)
+            (unused)
         @type bool (optional)
         @return translated filename
         @rtype str
@@ -1591,8 +1592,15 @@
         @param sock reference to the socket to read data from
         @type QTcpSocket
         """
+        headerSize = struct.calcsize(b"!II")
+
         while sock and sock.bytesAvailable():
-            header = sock.read(struct.calcsize(b"!II"))
+            now = time.monotonic()
+            while sock.bytesAvailable() < headerSize:
+                sock.waitForReadyRead(50)
+                if time.monotonic() - now > 2.0:  # 2 seconds timeout
+                    return
+            header = sock.read(headerSize)
             length, datahash = struct.unpack(b"!II", header)
 
             data = bytearray()

eric ide

mercurial