xemu/python/qemu/aqmp
John Snow 40196c2393 python/aqmp: add _session_guard()
In _new_session, there's a fairly complex except clause that's used to
give semantic errors to callers of accept() and connect(). We need to
create a new two-step replacement for accept(), so factoring out this
piece of logic will be useful.

Bolster the comments and docstring here to try and demystify what's
going on in this fairly delicate piece of Python magic.

(If we were using Python 3.7+, this would be an @asynccontextmanager. We
don't have that very nice piece of magic, however, so this must take an
Awaitable to manage the Exception contexts properly. We pay the price
for platform compatibility.)

Signed-off-by: John Snow <jsnow@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20220225205948.3693480-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2022-03-07 14:36:41 -05:00
..
__init__.py python/aqmp: rename AQMPError to QMPError 2022-01-21 16:01:31 -05:00
aqmp_tui.py python/aqmp: use absolute import statement 2022-01-10 18:22:33 -05:00
error.py python/aqmp: rename AQMPError to QMPError 2022-01-21 16:01:31 -05:00
events.py python/aqmp: rename AQMPError to QMPError 2022-01-21 16:01:31 -05:00
legacy.py python/aqmp: add socket bind step to legacy.py 2022-02-02 14:12:22 -05:00
message.py python/aqmp: add QMP Message format 2021-09-27 12:10:29 -04:00
models.py python/aqmp: Add dict conversion method to Greeting object 2021-10-12 12:22:10 -04:00
protocol.py python/aqmp: add _session_guard() 2022-03-07 14:36:41 -05:00
py.typed python/aqmp: add asynchronous QMP (AQMP) subpackage 2021-09-27 12:10:27 -04:00
qmp_client.py python/aqmp: Fix negotiation with pre-"oob" QEMU 2022-02-02 14:12:22 -05:00
qmp_shell.py python: support recording QMP session to a file 2022-02-23 17:07:26 -05:00
util.py python/aqmp: add asyncio_run compatibility wrapper 2021-09-27 12:10:29 -04:00