diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus_singleton.cpp | 13 | ||||
-rw-r--r-- | src/webserver_main.cpp | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/dbus_singleton.cpp b/src/dbus_singleton.cpp new file mode 100644 index 0000000000..f78164fbe2 --- /dev/null +++ b/src/dbus_singleton.cpp @@ -0,0 +1,13 @@ +#include "dbus_singleton.hpp" + +#include <boost/asio/io_context.hpp> + +namespace crow +{ +namespace connections +{ + +sdbusplus::asio::connection* systemBus = nullptr; + +} // namespace connections +} // namespace crow diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp index ff0bbd7420..c306dea958 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -65,8 +65,8 @@ static int run() auto io = std::make_shared<boost::asio::io_context>(); App app(io); - crow::connections::systemBus = - std::make_shared<sdbusplus::asio::connection>(*io); + sdbusplus::asio::connection systemBus(*io); + crow::connections::systemBus = &systemBus; // Static assets need to be initialized before Authorization, because auth // needs to build the whitelist from the static routes @@ -147,7 +147,8 @@ static int run() app.run(); io->run(); - crow::connections::systemBus.reset(); + crow::connections::systemBus = nullptr; + return 0; } |