Skip to content

dbus/win: use a unix domain socket on windows for autolaunch: protocol by default if supported by host

This is an alternative to !327 and avoids the need to use multiple autostart addresses. Unix domain sockets are used if the host on which dbus is running supports it.

It was tested on a Windows 10 host with

set DBUS_VERBOSE=1
dbus-daemon --config-file=..\bus\session.conf --address=autolaunch:

where dbus-daemon successfully listened to a Unix domain socket, see dbgview output:

[5472] dbus-daemon: [dbus/dbus-sysdeps-win.c(4428):_dbus_listen_unix_socket] listening on unix socket C:\Users\Admin\AppData\Local\Temp\dbus-5hNzN967cn abstract=0
[5472] dbus-daemon: [dbus/dbus-server.c(166):_dbus_server_init_base] Initialized server on address unix:path=C%3a\Users\Admin\AppData\Local\Temp\dbus-5hNzN967cn,guid=48cc71c258c1c0eafeb16e5c63d7ca8b
[5472] dbus-daemon: [dbus/dbus-sysdeps-win.c(3023):_dbus_daemon_publish_session_bus_address] address:unix:path=C%3a\Users\Admin\AppData\Local\Temp\dbus-5hNzN967cn,guid=48cc71c258c1c0eafeb16e5c63d7ca8b scope:(null)
[5472] dbus-daemon: [dbus/dbus-sysdeps-win.c(3084):_dbus_daemon_publish_session_bus_address] published session bus address at DBusDaemonAddressInfo

and dbus-monitor has successfully connected to this Unix domain socket.

set DBUS_VERBOSE=1
dbus-monitor
signal time=1675086517.100524 sender=org.freedesktop.DBus -> destination=:1.0 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.0"
signal time=1675086517.131770 sender=org.freedesktop.DBus -> destination=:1.0 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.0"

see dbgview output

[1376] dbus-monitor: [dbus/dbus-sysdeps-win.c(3281):_dbus_get_autolaunch_address] found running dbus daemon for scope '' at DBusDaemonAddressInfo
[1376] dbus-monitor: [dbus/dbus-sysdeps-win.c(4348):_dbus_connect_unix_socket] connecting to unix socket C:\Users\Admin\AppData\Local\Temp\dbus-5hNzN967cn abstract=0
[1376] dbus-monitor: [dbus/dbus-transport-socket.c(1554):_dbus_transport_new_for_domain_socket] Successfully connected to unix socket C:\Users\Admin\AppData\Local\Temp\dbus-5hNzN967cn
[5472] dbus-daemon: [dbus/dbus-sysdeps-win.c(1477):_dbus_poll_select] select: to=1
Edited by Ralf Habacker

Merge request reports

Loading