Changeset: ab947561e46c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ab947561e46c
Modified Files:
        testing/Mtest.py.in
Branch: Mar2025
Log Message:

Prepare Mtest.py's mapi_ping() for short reads


diffs (31 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -2997,6 +2997,14 @@ def RunIt(cmd, onechild, TestIn, TestOut
     return rc
 
 
+def recv_all(sock: socket.socket, nbytes):
+    data = sock.recv(nbytes)
+    while len(data) < nbytes:
+        more_data = sock.recv(nbytes - len(data))
+        data += more_data
+    return data
+
+
 def mapi_ping(port, host='localhost', tries=3):
     retry = 0
     wait = 1
@@ -3005,10 +3013,10 @@ def mapi_ping(port, host='localhost', tr
         try:
             with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
                 sock.connect((host, port))
-                flag = sock.recv(2)
+                flag = recv_all(sock, 2)
                 unpacked = struct.unpack( '<H', flag )[0]  # little endian 
short
                 len = ( unpacked >> 1 )     # get length
-                data = sock.recv(len)
+                data = recv_all(sock, len)
             # we don't send
             return True
         except OSError:
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to