diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-05-15 01:15:30 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-15 01:15:30 +0200 |
commit | 19befb2d5fc087f96e40ddc432b2cc9385666209 (patch) | |
tree | 4a28a54ed25ba8fb57578f639b2691749c9c935e /src/bus-proxyd | |
parent | 9a78148e40402b44f361f4fbf63bb97a21aeac0b (diff) |
sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and
creates proper object for unregistering callbacks.
Taking the refernce to the slot is optional. If not taken life time of
the slot will be bound to the underlying bus object (or in the case of
an async call until the reply has been recieved).
Diffstat (limited to 'src/bus-proxyd')
-rw-r--r-- | src/bus-proxyd/bus-proxyd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index c5f9f002fe..e095d61ffb 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -40,6 +40,7 @@ #include "bus-internal.h" #include "bus-message.h" #include "bus-util.h" +#include "bus-internal.h" #include "build.h" #include "strv.h" #include "def.h" @@ -551,7 +552,7 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) { if (r < 0) return synthetic_reply_method_errno(m, r, NULL); - r = sd_bus_add_match(a, match, NULL, NULL); + r = sd_bus_add_match(a, NULL, match, NULL, NULL); if (r < 0) return synthetic_reply_method_errno(m, r, NULL); @@ -564,7 +565,9 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) { if (r < 0) return synthetic_reply_method_errno(m, r, NULL); - r = sd_bus_remove_match(a, match, NULL, NULL); + r = bus_remove_match_by_string(a, match, NULL, NULL); + if (r == 0) + return synthetic_reply_method_error(m, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_MATCH_RULE_NOT_FOUND, "Match rule not found")); if (r < 0) return synthetic_reply_method_errno(m, r, NULL); @@ -739,9 +742,10 @@ static int process_driver(sd_bus *a, sd_bus *b, sd_bus_message *m) { r = sd_bus_release_name(a, name); if (r < 0) { if (r == -ESRCH) - synthetic_reply_method_return(m, "u", BUS_NAME_NON_EXISTENT); + return synthetic_reply_method_return(m, "u", BUS_NAME_NON_EXISTENT); if (r == -EADDRINUSE) - synthetic_reply_method_return(m, "u", BUS_NAME_NOT_OWNER); + return synthetic_reply_method_return(m, "u", BUS_NAME_NOT_OWNER); + return synthetic_reply_method_errno(m, r, NULL); } @@ -1177,7 +1181,7 @@ int main(int argc, char *argv[]) { goto finish; } - r = sd_bus_add_match(a, match, NULL, NULL); + r = sd_bus_add_match(a, NULL, match, NULL, NULL); if (r < 0) { log_error("Failed to add match for NameLost: %s", strerror(-r)); goto finish; @@ -1198,7 +1202,7 @@ int main(int argc, char *argv[]) { goto finish; } - r = sd_bus_add_match(a, match, NULL, NULL); + r = sd_bus_add_match(a, NULL, match, NULL, NULL); if (r < 0) { log_error("Failed to add match for NameAcquired: %s", strerror(-r)); goto finish; |