Re: Getting repeatable connection problem after using an event loop
Jimi Damon <[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <CAHkuPsudpZ+QSs1MAnz9G_8kFpEGcijvri1KxcsAOeEynmMxsQ@mail.gmail.com> |
Thanks Lawrence, The problem was 100% attributed to the error not being set to SD_BUS_ERROR_NULL . I also took your advice and made the change to the sd_bus_add_match but I haven't noticed a difference with my unit tests. -Jimi On Sat, Oct 3, 2020 at 3:58 PM Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]> wrote: > On Sat, 3 Oct 2020 08:28:36 -0700, Jimi Damon wrote: > > > /* Callback Function */ > > int32_t tcb(sd_bus_message* message, void* userdata, sd_bus_error* > > error) > > { > > > > waiting_control_t* ud = userdata; > > if (ud) > > { > > /* printf("CALLBACK CALLED\n"); */ > > ud->found = 1; > > sd_bus_slot_unref(ud->slot); > > } > > > > return EXIT_SUCCESS; > > } > > Just a thought, the man page > <https://www.freedesktop.org/software/systemd/man/sd_bus_add_match.html> > says “If [the callback] wants other callbacks that match the same rule > to be called, it should return 0. Otherwise it should return a positive > integer”. Here you are returning 0 (EXIT_SUCCESS). Does it make a > difference if you return a value like 1? > > > The problem I have is that if I call another API function > > (logging_client_set_log_path) AFTER I have called this function, then > > the second API call (which sets a property) ALWAYS fails with a -22 > > return code (coming from sd_bus_set_property). However, if I don't > > call this wait_for_signal API call, then my other API function seems > > to always succeed. > > According to this > <https://www.freedesktop.org/software/systemd/man/sd_bus_call.html> > (and also checking /usr/include/asm-generic/errno-base.h), that value is > -EINVAL, and there is a list of possible reasons for such an error. The > fourth one kind of stands out for me: “The input parameter error is > non-NULL but was not set to SD_BUS_ERROR_NULL”. Could that be > applicable? > _______________________________________________ > dbus mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/dbus > _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus