-1

When calling dbus_connection_send_with_reply through the D-Bus C API in Linux, I pass in a timeout of 1000ms, but the timeout never occurs when the receiving application doesn't reply.

If the receiving application does send a reply then this is received correctly.

Could this be due to the way that I'm servicing libdbus?

I am calling dbus_connection_dispatch and dbus_connection_dispatch periodically for servicing.

Thanks

User55412
  • 882
  • 2
  • 10
  • 27

1 Answers1

1

It is highly recommended that you use a D-Bus library other than libdbus, as libdbus is fiddly to use correctly, as you are finding. If possible, use GDBus or QtDBus instead, as they are much higher-level bindings which are easier to use. If you need a lower-level binding, sd-bus is more modern than libdbus.

If you use GDBus, you can use GMainLoop to implement a main loop to handle timeouts, and set the timeout period with g_dbus_proxy_set_default_timeout() or in the arguments to individual g_dbus_proxy_call() calls. If you use sd-bus, you can use sd-event.

Philip Withnall
  • 5,293
  • 14
  • 28