connection: add createDefaultBusConnection()
This internally calls sd_bus_open(), which automatically selects the system or session bus connection based on the presence and content of a DBUS_STARTER_BUS_TYPE environment variable and whether the calling process has root privileges. This option is very helpful when creating services and clients that will use the system bus in production, but connect to a session for testing. Additional changes: * Removed assertions null-checking make_unique() return values. make_unique() calls new, and new is expected to throw or abort on failure, making the assertions unhelpful. * Corrected a typo in the ClosesAndUnrefsBusWhenDestructed unit test for the system bus (tested the wrong function).
This commit is contained in:
1 parent
d74365c535
commit
75ea127374
8 files changed
+87
-6
No files matched your search
@@ -58,6 +58,7 @@ public:
|
||||
virtual int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, char **interfaces) override;
|
||||
virtual int sd_bus_emit_interfaces_removed_strv(sd_bus *bus, const char *path, char **interfaces) override;
|
||||
|
||||
virtual int sd_bus_open(sd_bus **ret) override;
|
||||
virtual int sd_bus_open_user(sd_bus **ret) override;
|
||||
virtual int sd_bus_open_system(sd_bus **ret) override;
|
||||
virtual int sd_bus_open_system_remote(sd_bus **ret, const char* hsot) override;
|
||||
|
||||
Reference in new issue
Block a user