[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
- [PATCH v3 05/25] python/aqmp: add generic async message-based protocol support, (continued)
- [PATCH v3 05/25] python/aqmp: add generic async message-based protocol support, John Snow, 2021/08/03
- [PATCH v3 06/25] python/aqmp: add runstate state machine to AsyncProtocol, John Snow, 2021/08/03
- [PATCH v3 08/25] python/aqmp: add logging to AsyncProtocol, John Snow, 2021/08/03
- [PATCH v3 11/25] python/aqmp: add _cb_inbound and _cb_outbound logging hooks, John Snow, 2021/08/03
- [PATCH v3 04/25] python/aqmp: add asyncio compatibility wrappers, John Snow, 2021/08/03
- [PATCH v3 09/25] python/aqmp: add AsyncProtocol.accept() method, John Snow, 2021/08/03
- Re: [PATCH v3 09/25] python/aqmp: add AsyncProtocol.accept() method,
Eric Blake <=
[PATCH v3 10/25] python/aqmp: add configurable read buffer limit, John Snow, 2021/08/03
[PATCH v3 14/25] python/aqmp: add well-known QMP object models, John Snow, 2021/08/03
[PATCH v3 12/25] python/aqmp: add AsyncProtocol._readline() method, John Snow, 2021/08/03
[PATCH v3 13/25] python/aqmp: add QMP Message format, John Snow, 2021/08/03