Progress feedback and cancellation of long-running method calls.

David Woodhouse dwmw2 at infradead.org
Tue Jun 28 06:20:54 PDT 2011


We have some long-running DBus method calls which may need to be
cancelled, and for which we want to receive progress information.

The natural way to do this on DBus would be to use the serial number of
the outstanding method call.

So we'd send a signal to our DBus server, saying "please cancel the
outstanding method call which had serial# 554".

And the server would send signals back to the client, saying "the method
call with serial #553 is at 55% complete".

Followed eventually by an normal method return (or error) for the call,
of course.

The current implementation uses dbus-glib. The method calls on the
server side can obtain the serial number of the request from the
DBusGMethodInvocation pointer that they each receive:
(dbus_message_get_reply_serial(dbus_g_method_get_reply(context))).

So that part is simple enough.

The problem is on the *client* side. That's using dbus-glib too, but
there seems to be no way to find the serial number that was used for a
given call that we made with dbus_g_proxy_begin_call(). 

I looked briefly at converting to GDBus, but g_dbus_connection_call()
doesn't seem to give me any way to find the serial number of the
underlying call that it made *either*.

Am I missing something?

I'm probably going to fall back to just generating *another* client-side
ID for each request, included in the parameters of the method call.
Which makes me unhappy because we already *have* a client-generated ID
for each request: the DBus serial number.

(It would be really nice if there were real DBus message types for
progress and cancellation of method calls too, fwiw. Those are
extensible to allow new message types, right?)

-- 
dwmw2



More information about the dbus mailing list