signals

Havoc Pennington hp@redhat.com
19 Sep 2003 17:25:08 -0400


On Fri, 2003-09-19 at 17:14, Waldo Bastian wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Friday 19 September 2003 22:40, Havoc Pennington wrote:
> > I am leaning toward connections in the bus only, client always sends all
> > signal emissions over the wire. Implementation will require libdbus to
> > be more aware of whether it's connected to a bus or just a single peer.
> 
> That's what we do in DCOP. 

Right, one reason I like doing it this way. ;-)

> > Perhaps the bus-side connection could even _store_ a method name, and we
> > could say that clients never receive a signal, they only receive method
> > calls that have been connected to a signal. That is, we could synthesize
> > a message invoking the connected method on the bus side.
> 
> Yes, that's what I'm saying :-)

Keep in mind that this won't work in the 1-to-1 case, where the app
would get the signal emission and then have to synthesize the method
calls itself.

> > I lean toward the "C callback" answer though; it seems to me that
> > usually you don't want to have to be a D-BUS server/object in order to
> > handle notification messages.
> 
> I can see benefit in having a client/server separation but for the other part 
> the requirements are pretty similar to normal remote method calls.
> 
> Maybe clients that aren't a server but that do want to handle notifications 
> can be a server-lite, which is pretty much a regular server but with all the 
> bits that aren't needed in such scenario either thrown out or disabled.

Something I had in CVS at one point but I think deleted was a
"DBusCallbackObject" which was a way to make a trivial object by passing
in a callback and a method name, the callback was then called when the
method was invoked.

The idea of the C callback would be that you can just make the C
callback do what you want; e.g. in Qt binding it would probably invoke a
slot by name.

The question here I guess is whether DBusConnection maintains a
signal-to-C-callback mapping where the C callback does a
binding-specific thing, or DBusConnection maintains a
signal-to-D-BUS-object/method mapping and bindings don't have special
code for signal connections really.

Maybe I need to experiment with sketching out the API/implementation a
bit.

Havoc