Re: Getting repeatable connection problem after using an event loop

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.