Skip to main content

Module bus

Module bus 

Source
Expand description

Every D-Bus connection Sioul makes on Linux and the BSDs, made here alone: the system’s reading (power.rs), the notifications (notify.rs), the desktop’s do-not-disturb (dnd.rs), colord’s word on the screens (sioul-app’s colour.rs).

libdbus’s own ways to reach a bus (dbus_bus_get, dbus_bus_get_private, dbus_bus_register, behind the dbus crate’s new_session, new_system and new_address) hold its process-wide locks across the connection’s Hello, which they wait for without limit: a bus that takes a connection and never answers held every other D-Bus connection of the process with it, being made or closed, and Qt’s own at Sioul’s exit (review of battery part C, G1). Here the connection is opened as a plain one (dbus_connection_open_private, which takes none of those locks), its Hello said by Sioul, and the whole setup (the socket, the authentication, the Hello’s answer) waited for on a thread of its own, SETUP at most: such a bus then holds that one thread, never the caller and never another connection. While a setup to a bus has been under way longer than its limit, none more is tried there: the next is refused at once, until the bus answers it, or another bus answers at the same place (a socket file made anew: socket_of).

The connection made is the same as before in every other way: private, not closing the program when the bus goes, its name given by the bus. Only libdbus’s own record of that name is not kept (unique_name says none), which nothing in Sioul reads.

Structs§

Setup 🔒
A setup under way (UNDER_WAY).

Constants§

SETUP
How long a connection’s setup may take: its socket, its authentication and its Hello’s answer.

Statics§

UNDER_WAY 🔒
The setups under way: the bus’s address, when it began, its limit, and its number.

Functions§

connect
A connection to the bus at address (a D-Bus address, as DBUS_SESSION_BUS_ADDRESS gives one), made within SETUP.
connect_within
connect, made within limit: on a thread of its own, its answer waited for limit at most; refused at once while an earlier setup to the same bus has been under way longer than its own limit (refused).
escaped
A path as a D-Bus address writes it: each byte but letters, digits and -_/.\* as % and its two hex digits.
finished 🔒
Setup number no longer under way.
refused 🔒
Whether a new setup to address, whose socket file is socket now, is refused at now: one under way to the same bus (the same address, the same socket file) has been so longer than its limit (the bus takes connections and does not answer them). A bus started again at that path, the old one hung but alive, is another bus, tried at once.
session
A connection to the session’s bus (session_address), made within SETUP.
session_address
The session’s bus as libdbus finds it: DBUS_SESSION_BUS_ADDRESS, else the user’s bus in XDG_RUNTIME_DIR when there is one; none, no session bus.
set_up 🔒
The setup itself: the socket, then this connection’s Hello, said here and its answer waited for limit at most once it went out (it goes out only once the bus answered the authentication).
socket_of 🔒
The socket file of a unix:path= address (its first one), as it is now: its device and inode; none for another kind of address (an abstract socket’s name, TCP), or no file there.
system
A connection to the system’s bus (system_address), made within SETUP.
system_address
The system’s bus as libdbus finds it: DBUS_SYSTEM_BUS_ADDRESS, else its usual socket.
unix_path 🔒
The path a unix:path= address names, its escapes undone (escaped).