refactor: Connect socket events in ctor for daemon IPC client

This commit is contained in:
Nick Bolton 2025-02-10 18:00:34 +00:00
parent dc6383d593
commit 389028ccf9

View file

@ -21,6 +21,8 @@ DaemonIpcClient::DaemonIpcClient(QObject *parent)
: QObject(parent),
m_socket{new QLocalSocket(this)} // NOSONAR - Qt memory
{
connect(m_socket, &QLocalSocket::disconnected, this, &DaemonIpcClient::handleDisconnected);
connect(m_socket, &QLocalSocket::errorOccurred, this, &DaemonIpcClient::handleErrorOccurred);
}
bool DaemonIpcClient::connectToServer()
@ -38,9 +40,6 @@ bool DaemonIpcClient::connectToServer()
return false;
}
connect(m_socket, &QLocalSocket::disconnected, this, &DaemonIpcClient::handleDisconnected);
connect(m_socket, &QLocalSocket::errorOccurred, this, &DaemonIpcClient::handleErrorOccurred);
m_connected = true;
qInfo() << "ipc client connected to server:" << kDaemonIpcName;
Q_EMIT connected();