guelfey / go.dbus

Native Go bindings for D-Bus
BSD 2-Clause "Simplified" License
124 stars 42 forks source link

prop.Prop only supports one connection #45

Open alexlarsson opened 10 years ago

alexlarsson commented 10 years ago

If you have an object that is exposed on multiple connections (for instance one in a server that allows peer-to-peer connections) it cannot use the current properties support, because it is tied to a specific connection. It should be possible to create the Prop type without reference to an existing connection, and then later export it on one or more connections as they arrive.

guelfey commented 10 years ago

A value of the Prop type needs to have some kind of reference to the connection because it may need to send signals to the message bus, and it has no way of obtaining it from a method call. I'm planning to merge the functionality of the prop and introspect packages into the main package in the long run, which should fix this issue then.

alexlarsson commented 10 years ago

Well, obviously a property is not very useful if never gets exposed on a connection. However it is still useful to be able to have a property object that is not currently exposed on a connection. For instance, if you are implementing a dbus server that accepts client peer to peer connections (like eg the dbus daemon). In such a setup you want to create a new prop object that keeps the current state, and then whenever a new client connects you add that connection to the list of connections that the prop sends signals to.

This would have an api something like: prop = NewProp() prop.Expose(conn1, path) On Dec 9, 2013 5:56 PM, "guelfey" notifications@github.com wrote:

A value of the Prop type needs to have some kind of reference to the connection because it may need to send signals to the message bus, and it has no way of obtaining it from a method call. I'm planning to merge the functionality of the prop and introspect packages into the main package in the long run, which should fix this issue then.

— Reply to this email directly or view it on GitHubhttps://github.com/guelfey/go.dbus/issues/45#issuecomment-30149348 .