go.dbus
go.dbus copied to clipboard
May be shouldn't auto invoke Conn.inWoker.
There is an problem when invoke Conn.inWoker before an dbus object has be exported.
If objectpath A is exported after invoked Conn.inWoker then bus message to objectpath A will be discarded before objectpath A is exported. (I think this is normal and only way now)
And this scene will happen when an dbus serivce is launched by dbus-daemon (service file) caused application freeze (wait dbus timeout).
seems like even invoke inWoker later manually still cause this problem.
because the SessionBus()/SystemBus() will invoke conn.Hello() or the name acquire dbus message which rely on inWoker is invoked.
I workaround this by https://github.com/linuxdeepin/go-lib/commit/514c14fad3d315379105fb6fe5af439bbf64c9b4
use DBUS_STARTER_BUS_TYPE env to detect wehter this program is launched by dbus-daemon. Then use an unhandledMsgs map[string][]*Message (inside Conn) to store unhandled type=method_call message, and handl it in func (conn *Conn) RequestName.
Wish you can find more elegant way to solve this problem.