mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user