hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

How can I actually use `withAutoConnect(false)`? #212

Closed brett-smith closed 1 year ago

brett-smith commented 1 year ago

I am trying to make use of DirectConnection, but have hit an issue with reliable synchronization of start up of the client and server parts of the code.

This problem is actually demonstrated by the TestPeer2Peer test, which I believe only actually works more through luck than actually being 100% solid. I intend to raise a separate issue for this, as it may take a little explanation.

Anyway, to work around the problem, I need to use withAutoConnect(). This gives me a DirectConnection with an unconnected transport, but I see no way to then get at the AbstractTransport to call listen() myself (in a new thread).

Is there something in the API I am missing?

hypfvieh commented 1 year ago

You are right, the method to connect a not-auto-connected transport is missing. I updated the current code to include a connect() method which will connect the transport if it wasn't connected before.

brett-smith commented 1 year ago

Great, thanks for fast response.