From acd340158aacce126cb0736681b1fb7cacb07e81 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 18 Dec 2017 20:50:26 +0100 Subject: [PATCH] sd-bus: when removing a server-side match, do so in "fire and forget" fashion We currently wait for the RemoveMatch() reply, but then ignore what it actually says. Let's optimize this a bit, and not even ask for an answer back: just enqueue the RemoveMatch() operation, and do not request not wait for any answer. --- src/libsystemd/sd-bus/bus-control.c | 5 ++++- src/libsystemd/sd-bus/bus-slot.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index aa247db..7182616 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -851,8 +851,11 @@ int bus_remove_match_internal( e = append_eavesdrop(bus, match); - return sd_bus_call_method( + /* Fire and forget */ + + return sd_bus_call_method_async( bus, + NULL, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", diff --git a/src/libsystemd/sd-bus/bus-slot.c b/src/libsystemd/sd-bus/bus-slot.c index f8de699..0b5e2b7 100644 --- a/src/libsystemd/sd-bus/bus-slot.c +++ b/src/libsystemd/sd-bus/bus-slot.c @@ -94,7 +94,7 @@ void bus_slot_disconnect(sd_bus_slot *slot) { case BUS_MATCH_CALLBACK: if (slot->match_added) - bus_remove_match_internal(slot->bus, slot->match_callback.match_string); + (void) bus_remove_match_internal(slot->bus, slot->match_callback.match_string); slot->bus->match_callbacks_modified = true; bus_match_remove(&slot->bus->match_callbacks, &slot->match_callback); -- 2.7.4