src/eric7/Debugger/DebuggerInterfacePython.py

branch
server
changeset 10680
306373ccf8fd
parent 10636
24d9e6ff8111
parent 10653
d169909ad8d2
child 10704
27d21e5163b8
diff -r 280a53840aa3 -r 306373ccf8fd src/eric7/Debugger/DebuggerInterfacePython.py
--- a/src/eric7/Debugger/DebuggerInterfacePython.py	Tue Mar 26 10:55:04 2024 +0100
+++ b/src/eric7/Debugger/DebuggerInterfacePython.py	Wed Apr 10 17:03:56 2024 +0200
@@ -13,6 +13,7 @@
 import os
 import shlex
 import struct
+import time
 import zlib
 
 from PyQt6.QtCore import QObject, QProcess, QProcessEnvironment, QTimer, pyqtSlot
@@ -1595,11 +1596,17 @@
             length, datahash = struct.unpack(b"!II", header)
 
             data = bytearray()
+            now = time.monotonic()
             while len(data) < length:
                 maxSize = length - len(data)
                 if sock.bytesAvailable() < maxSize:
                     sock.waitForReadyRead(50)
-                data += sock.read(maxSize)
+                newData = sock.read(maxSize)
+                if newData:
+                    data += newData
+                else:
+                    if time.monotonic() - now > 2.0:  # 2 seconds timeout
+                        break
 
             if zlib.adler32(data) & 0xFFFFFFFF != datahash:
                 # corrupted data -> discard and continue

eric ide

mercurial