feat(ipc): Log more detail on IPC error handling
This commit is contained in:
parent
25f3eb3f22
commit
77bee2ddf3
2 changed files with 9 additions and 1 deletions
|
|
@ -118,7 +118,7 @@ void IpcServer::processMessage(QLocalSocket *clientSocket, const QString &messag
|
|||
|
||||
if (clientVersion != versionId) {
|
||||
LOG_ERR("%s ipc client version mismatch (server: %s)", m_typeName.constData(), versionId.toUtf8().constData());
|
||||
writeToClientSocket(clientSocket, "error");
|
||||
writeToClientSocket(clientSocket, QStringLiteral("error=version mismatch, expected: %1").arg(versionId));
|
||||
clientSocket->flush();
|
||||
clientSocket->disconnectFromServer();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -163,6 +163,14 @@ void IpcClient::handleReadyRead()
|
|||
|
||||
void IpcClient::handleHandshakeMessage(const QStringList &parts)
|
||||
{
|
||||
if (parts.at(0) == "error") {
|
||||
const auto detail = parts.size() >= 2 ? parts.at(1) : QString("unknown");
|
||||
qCritical().noquote() << m_typeName << "ipc server rejected connection:" << detail;
|
||||
disconnectFromServer();
|
||||
Q_EMIT connectionFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (parts.at(0) != "hello") {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue