forked from qt-creator/qt-creator
LanguageClient: forcefully delete client after timeout
If the client does not react within 20 seconds on the shutdown or exit message delete the client. Task-number: QTCREATORBUG-27064 Change-Id: I9680242e471989ea820c4e28d28c500c27a20bb7 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -112,6 +112,11 @@ Client::Client(BaseClientInterface *clientInterface)
|
|||||||
|
|
||||||
m_tokenSupport.setTokenTypesMap(SemanticTokens::defaultTokenTypesMap());
|
m_tokenSupport.setTokenTypesMap(SemanticTokens::defaultTokenTypesMap());
|
||||||
m_tokenSupport.setTokenModifiersMap(SemanticTokens::defaultTokenModifiersMap());
|
m_tokenSupport.setTokenModifiersMap(SemanticTokens::defaultTokenModifiersMap());
|
||||||
|
|
||||||
|
m_shutdownTimer.setInterval(20 /*seconds*/ * 1000);
|
||||||
|
connect(&m_shutdownTimer, &QTimer::timeout, this, [this] {
|
||||||
|
LanguageClientManager::deleteClient(this);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Client::name() const
|
QString Client::name() const
|
||||||
@@ -325,6 +330,7 @@ void Client::shutdown()
|
|||||||
});
|
});
|
||||||
sendContent(shutdown);
|
sendContent(shutdown);
|
||||||
m_state = ShutdownRequested;
|
m_state = ShutdownRequested;
|
||||||
|
m_shutdownTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
Client::State Client::state() const
|
Client::State Client::state() const
|
||||||
@@ -1551,6 +1557,7 @@ void Client::initializeCallback(const InitializeRequest::Response &initResponse)
|
|||||||
|
|
||||||
void Client::shutDownCallback(const ShutdownRequest::Response &shutdownResponse)
|
void Client::shutDownCallback(const ShutdownRequest::Response &shutdownResponse)
|
||||||
{
|
{
|
||||||
|
m_shutdownTimer.stop();
|
||||||
QTC_ASSERT(m_state == ShutdownRequested, return);
|
QTC_ASSERT(m_state == ShutdownRequested, return);
|
||||||
QTC_ASSERT(m_clientInterface, return);
|
QTC_ASSERT(m_clientInterface, return);
|
||||||
optional<ShutdownRequest::Response::Error> errorValue = shutdownResponse.error();
|
optional<ShutdownRequest::Response::Error> errorValue = shutdownResponse.error();
|
||||||
@@ -1563,6 +1570,7 @@ void Client::shutDownCallback(const ShutdownRequest::Response &shutdownResponse)
|
|||||||
sendMessage(ExitNotification().toBaseMessage());
|
sendMessage(ExitNotification().toBaseMessage());
|
||||||
qCDebug(LOGLSPCLIENT) << "language server " << m_displayName << " shutdown";
|
qCDebug(LOGLSPCLIENT) << "language server " << m_displayName << " shutdown";
|
||||||
m_state = Shutdown;
|
m_state = Shutdown;
|
||||||
|
m_shutdownTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::sendWorkspceFolderChanges() const
|
bool Client::sendWorkspceFolderChanges() const
|
||||||
|
@@ -305,6 +305,7 @@ private:
|
|||||||
LogTarget m_logTarget = LogTarget::Ui;
|
LogTarget m_logTarget = LogTarget::Ui;
|
||||||
bool m_locatorsEnabled = true;
|
bool m_locatorsEnabled = true;
|
||||||
bool m_autoRequestCodeActions = true;
|
bool m_autoRequestCodeActions = true;
|
||||||
|
QTimer m_shutdownTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LanguageClient
|
} // namespace LanguageClient
|
||||||
|
Reference in New Issue
Block a user