var dbusC … var dbusMu … var dbusInited … var dbusRootless … type dbusConnManager … // newDbusConnManager initializes systemd dbus connection manager. func newDbusConnManager(rootless bool) *dbusConnManager { … } // getConnection lazily initializes and returns systemd dbus connection. func (d *dbusConnManager) getConnection() (*systemdDbus.Conn, error) { … } func (d *dbusConnManager) newConnection() (*systemdDbus.Conn, error) { … } // resetConnection resets the connection to its initial state // (so it can be reconnected if necessary). func (d *dbusConnManager) resetConnection(conn *systemdDbus.Conn) { … } // retryOnDisconnect calls op, and if the error it returns is about closed dbus // connection, the connection is re-established and the op is retried. This helps // with the situation when dbus is restarted and we have a stale connection. func (d *dbusConnManager) retryOnDisconnect(op func(*systemdDbus.Conn) error) error { … }