go.dbus icon indicating copy to clipboard operation
go.dbus copied to clipboard

prop.Prop only supports one connection

Open alexlarsson opened this issue 11 years ago • 2 comments
trafficstars

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.

alexlarsson avatar Dec 09 '13 09:12 alexlarsson

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.

guelfey avatar Dec 09 '13 16:12 guelfey

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" [email protected] 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 .

alexlarsson avatar Dec 09 '13 21:12 alexlarsson