Getting repeatable connection problem after using an event loop

Jimi Damon jdamon at gmail.com
Sun Oct 4 16:06:32 UTC 2020


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 at geek-central.gen.nz>
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
> dbus at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dbus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20201004/8b497cea/attachment.htm>


More information about the dbus mailing list