Remove the test connection and custom launch of dbus daemon

We cannot easily launch the dbus session ourselves since all other
applications don't know how to connect to it. We need to rely on the
supported solutions on different platforms. If the session bus is not
available, the workarounds would be huge to manually launch it and tell
all clients the session address.

ref T170
This commit is contained in:
Roland Winklmeier
2017-10-09 09:04:59 +02:00
parent e2f7ea87a3
commit 366548cf7a
2 changed files with 0 additions and 24 deletions

View File

@@ -31,14 +31,6 @@ namespace BlackMisc
{
case SERVERMODE_SESSIONBUS:
{
QDBusConnection testConnection = QDBusConnection::connectToBus(QDBusConnection::SessionBus, coreServiceName());
if (! testConnection.isConnected()) { launchDBusDaemon(); }
testConnection.disconnectFromBus(coreServiceName());
// Sleep for 200 ms in order for dbus-daemon to finish loading.
// FIXME: Dirty workaround. Instead polling the server up to x times every 50 ms until its connection is accepted.
QThread::msleep(200);
QDBusConnection connection = QDBusConnection::connectToBus(QDBusConnection::SessionBus, coreServiceName());
if (! connection.isConnected() || ! connection.registerService(service))
{
@@ -50,13 +42,6 @@ namespace BlackMisc
break;
case SERVERMODE_SYSTEMBUS:
{
QDBusConnection testConnection = QDBusConnection::connectToBus(QDBusConnection::SystemBus, coreServiceName());
if (! testConnection.isConnected()) { launchDBusDaemon(); }
testConnection.disconnectFromBus(coreServiceName());
// Sleep for 200 ms in order for dbus-daemon to finish loading.
QThread::msleep(200);
QDBusConnection connection = QDBusConnection::connectToBus(QDBusConnection::SystemBus, coreServiceName());
if (! connection.isConnected() || ! connection.registerService(service))
{
@@ -103,14 +88,6 @@ namespace BlackMisc
return sn;
}
void CDBusServer::launchDBusDaemon()
{
static const QString program = QStringLiteral("dbus-daemon");
static const QStringList arguments = { QStringLiteral("--session") };
const bool success = CProcessCtrl::startDetached(program, arguments, false);
if (!success) { CLogMessage(this).error("Failed to launch dbus-daemon!"); }
}
bool CDBusServer::isP2PAddress(const QString &address)
{
return modeOfAddress(address) == SERVERMODE_P2P;

View File

@@ -137,7 +137,6 @@ namespace BlackMisc
QMap<QString, QObject *> m_objects;
QMap<QString, QDBusConnection> m_connections;
void launchDBusDaemon();
static QString getDBusInterfaceFromClassInfo(QObject *object);
//! Register options with connection