refactor(ipcClient): declare values in if statement where possible
This commit is contained in:
parent
7f2953d422
commit
bdb7309778
1 changed files with 3 additions and 6 deletions
|
|
@ -49,11 +49,9 @@ void IpcClient::connectToServer()
|
||||||
|
|
||||||
void IpcClient::attemptConnection()
|
void IpcClient::attemptConnection()
|
||||||
{
|
{
|
||||||
const auto kRetryLimit = 3;
|
if (const int retryLimit = 3; m_retryCount >= retryLimit) {
|
||||||
|
|
||||||
if (m_retryCount >= kRetryLimit) {
|
|
||||||
qWarning().noquote() << QStringLiteral("%1 ipc client failed to connect after %2 attempts")
|
qWarning().noquote() << QStringLiteral("%1 ipc client failed to connect after %2 attempts")
|
||||||
.arg(m_typeName, QString::number(kRetryLimit));
|
.arg(m_typeName, QString::number(retryLimit));
|
||||||
m_state = State::Unconnected;
|
m_state = State::Unconnected;
|
||||||
Q_EMIT connectionFailed();
|
Q_EMIT connectionFailed();
|
||||||
return;
|
return;
|
||||||
|
|
@ -183,8 +181,7 @@ void IpcClient::handleHandshakeMessage(const QStringList &parts)
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto versionId = QStringLiteral("%1+%2").arg(kVersion, kVersionGitSha);
|
const auto versionId = QStringLiteral("%1+%2").arg(kVersion, kVersionGitSha);
|
||||||
const auto serverVersion = parts.at(1);
|
if (const auto serverVersion = parts.at(1); serverVersion != versionId) {
|
||||||
if (serverVersion != versionId) {
|
|
||||||
qCritical().noquote(
|
qCritical().noquote(
|
||||||
) << QStringLiteral("%1 ipc version mismatch (client: %2 , server: %3)").arg(m_typeName, versionId, serverVersion);
|
) << QStringLiteral("%1 ipc version mismatch (client: %2 , server: %3)").arg(m_typeName, versionId, serverVersion);
|
||||||
disconnectFromServer();
|
disconnectFromServer();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue