qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] python: honour message limit when using pre-opened socket


From: Daniel P . Berrangé
Subject: [PATCH] python: honour message limit when using pre-opened socket
Date: Mon, 20 Mar 2023 10:54:04 +0000

The default message recv limit in asyncio is smaller than our needs, so
when opening connections we override it. This was done when opening a
connection using a socket address, but was missed when using a
pre-opened socket file descriptor.

This latent bug was exposed when the QEMUMachine class was enhanced to
use socketpair() when no socket address was passed by:

  commit bd4c0ef409140bd1be393407c04005ac077d4574
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Wed Jan 11 12:01:01 2023 +0400

    python/qemu/machine: use socketpair() for QMP by default

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 python/qemu/qmp/protocol.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py
index 22e60298d2..2bd341a93e 100644
--- a/python/qemu/qmp/protocol.py
+++ b/python/qemu/qmp/protocol.py
@@ -307,7 +307,10 @@ async def open_with_socket(self, sock: socket.socket) -> 
None:
 
         :raise StateError: When the `Runstate` is not `IDLE`.
         """
-        self._reader, self._writer = await asyncio.open_connection(sock=sock)
+        self._reader, self._writer = await asyncio.open_connection(
+            sock=sock,
+            limit=self._limit,
+        )
         self._set_state(Runstate.CONNECTING)
 
     @upper_half
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]