On Di, 24.03.20 21:43, Stanislav Angelovič (angelovic.s@xxxxxxxxx) wrote: > Hi folks, > > Please, what is the difference in sd-bus behavior when my D-Bus signal > callback returns a zero return value versus a positive return value? positive means "I processed the message, stop processing it further". negative means "This message did not match my criteria, pass it to any other callback that might be interested. Basically, an incoming msg can match against multiple handlers, in particular if you combine multiple instances of sd_bus_add_filter() and sd_bus_add_match(). sd-bus will call them in the order you registered them in, and will pass the incoming signal to each one in turn as long as each returns 0. It stops when one returns > 0. In most cases you want to return 0, to allow everyone who wants have a look at the message. You'd return > 0 only if you want actively filter a message so that noone else can see it, maybe to hide stuff from other parts of the program if that's your kind of thing. > And what's the difference between those return values in D-Bus method > callback, D-Bus async method reply callback, D-Bus property get callback, > and D-Bus property set callback? it's always the same: whether to traverse the installed handlers further. Note that for method call handlers you typically want to return > 0 btw, because if you return 0 and sd-bus reaches the end of the list of registered handlers it assumes noone was interested and synthesizes a "NoSuchMethod" error reply. > Which shall I return in normal cases? Zero? when handling signals: zero. when handling incoming method calls: one. Lennart -- Lennart Poettering, Berlin _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel