src/eric7/Debugger/DebuggerInterfacePython.py

branch
eric7
changeset 10697
8a609e4c71b6
parent 10683
779cda568acb
child 10704
27d21e5163b8
child 10733
d96c69a235fc
child 10760
f702f6781b05
--- a/src/eric7/Debugger/DebuggerInterfacePython.py	Wed Apr 24 15:15:33 2024 +0200
+++ b/src/eric7/Debugger/DebuggerInterfacePython.py	Wed Apr 24 15:16:12 2024 +0200
@@ -1404,8 +1404,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