auth: natively support GCancellable in NMAuthChain

System Internals / NetworkManager - Thomas Haller [redhat.com] - 28 April 2020 16:35 EDT

We want that our asynchronous operations are cancellable.

In fact, NMAuthChain is already (manually) cancellable by the user calling nm_auth_chain_destroy(). However, sometimes we have a GCancellable at hand, so the callers would have to register to the cancellable themselves.

Instead, support setting a cancellable to the NMAuthChain, that aborts the request and invokes the callback.

It does so always on an idle handler. Also, the user may only set the cancellable once, and only before starting the first call.

ef7fd9e4e auth: natively support GCancellable in NMAuthChain
src/nm-auth-utils.c | 162 +++++++++++++++++++++++++++++++++++++++++++---------
src/nm-auth-utils.h | 4 ++
2 files changed, 138 insertions(+), 28 deletions(-)

Upstream: cgit.freedesktop.org


  • Share