qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 09/25] python/aqmp: add AsyncProtocol.accept() method


From: Eric Blake
Subject: Re: [PATCH v3 09/25] python/aqmp: add AsyncProtocol.accept() method
Date: Tue, 17 Aug 2021 14:29:49 -0500
User-agent: NeoMutt/20210205-719-68949a

On Tue, Aug 03, 2021 at 02:29:25PM -0400, John Snow wrote:
> It's a little messier than connect, because it wasn't designed to accept
> *precisely one* connection. Such is life.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  python/qemu/aqmp/protocol.py | 89 ++++++++++++++++++++++++++++++++++--
>  1 file changed, 85 insertions(+), 4 deletions(-)
> 
> diff --git a/python/qemu/aqmp/protocol.py b/python/qemu/aqmp/protocol.py
> index 77b330627b3..7eca65aa265 100644
> --- a/python/qemu/aqmp/protocol.py
> +++ b/python/qemu/aqmp/protocol.py
> @@ -243,6 +243,24 @@ async def runstate_changed(self) -> Runstate:
>          await self._runstate_event.wait()
>          return self.runstate
>  
> +    @upper_half
> +    @require(Runstate.IDLE)
> +    async def accept(self, address: Union[str, Tuple[str, int]],
> +                     ssl: Optional[SSLContext] = None) -> None:
> +        """
> +        Accept a connection and begin processing message queues.
> +
> +        If this call fails, `runstate` is guaranteed to be set back to 
> `IDLE`.
> +
> +        :param address:
> +            Address to listen to; UNIX socket path or TCP address/port.

Can't TCP use a well-known port name instead of an int?  But limiting
clients to just int port for now isn't fatal to the patch.

> +        :param ssl: SSL context to use, if any.
> +
> +        :raise StateError: When the `Runstate` is not `IDLE`.
> +        :raise ConnectError: If a connection could not be accepted.
> +        """
> +        await self._new_session(address, ssl, accept=True)
> +

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

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