forked from qt-creator/qt-creator
LanguageClient: Reset maximum restart tries on explicit restart
If the user forces the language client to restart for whatever reason the client may end up in not starting anymore depending on the number of restarts that had been done already. So, explicitly reset the counter in case the user triggers the restart. Change-Id: Ie5f33c8dc3d565b6126badc9708906fc14f4e743 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -592,6 +592,11 @@ bool Client::reachable() const
|
|||||||
return d->m_state == Initialized;
|
return d->m_state == Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::resetRestartCounter()
|
||||||
|
{
|
||||||
|
d->m_restartsLeft = ClientPrivate::MaxRestarts;
|
||||||
|
}
|
||||||
|
|
||||||
void Client::setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo)
|
void Client::setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo)
|
||||||
{
|
{
|
||||||
d->m_clientInfo = clientInfo;
|
d->m_clientInfo = clientInfo;
|
||||||
|
@@ -86,6 +86,7 @@ public:
|
|||||||
State state() const;
|
State state() const;
|
||||||
QString stateString() const;
|
QString stateString() const;
|
||||||
bool reachable() const;
|
bool reachable() const;
|
||||||
|
void resetRestartCounter();
|
||||||
|
|
||||||
void setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo);
|
void setClientInfo(const LanguageServerProtocol::ClientInfo &clientInfo);
|
||||||
// capabilities
|
// capabilities
|
||||||
|
@@ -159,6 +159,7 @@ void LanguageClientManager::clientFinished(Client *client)
|
|||||||
QTC_ASSERT(managerInstance, return);
|
QTC_ASSERT(managerInstance, return);
|
||||||
|
|
||||||
if (managerInstance->m_restartingClients.remove(client)) {
|
if (managerInstance->m_restartingClients.remove(client)) {
|
||||||
|
client->resetRestartCounter();
|
||||||
client->reset();
|
client->reset();
|
||||||
client->start();
|
client->start();
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user