]> git.ipfire.org Git - thirdparty/systemd.git/commit
qmp-client: make QmpSlot a public, refcounted, cancellable handle
authorDaan De Meyer <daan@amutable.com>
Fri, 24 Apr 2026 06:07:31 +0000 (06:07 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 24 Apr 2026 12:29:31 +0000 (14:29 +0200)
commit54c124eb6cf8a5d8430b491a0171a1dd62506182
tree2cbb9a60a0684ef531f9cd37bb2e68e5fa752879
parent89a4dba4a7fc0579e6a5552f257d33cbce3aba28
qmp-client: make QmpSlot a public, refcounted, cancellable handle

QmpSlot now stores a back-reference to its QmpClient (mirroring sd_bus_slot)
and is exposed as a public refcounted type via qmp_slot_ref/qmp_slot_unref.
qmp_client_invoke() gains an optional QmpSlot **ret_slot out-parameter
matching sd_bus_call_async(): passing non-NULL hands back a reference whose
unref cancels the pending call (the callback is deregistered; a late reply
is logged and discarded as unknown-id).

Internally slots come in two flavours, following sd_bus's model: floating
(owned by the client's pending set, used when ret_slot is NULL) and
non-floating (ref held by the caller, slot holds a ref on the client).
qmp_slot_disconnect() centralizes the teardown so the reply-dispatched,
explicit-cancel, and client-teardown paths all converge on the same
idempotent cleanup.

qmp_client_call()'s sync slot is now non-floating and observes completion
by watching slot->client go NULL instead of set_contains() on an id.
src/shared/qmp-client.c
src/shared/qmp-client.h
src/shared/shared-forward.h
src/test/test-qmp-client-qemu.c
src/test/test-qmp-client.c
src/vmspawn/vmspawn-qmp.c
src/vmspawn/vmspawn-varlink.c