86
// Handle unexpected exit
87
connection.store.add(connection.onDidProcessExit(e => {
89
>
this._hasActiveSessions = false;
90
>
this._connectionCount = 0;
91
>
this._lifetimeToken.clear();
92
>
93
>
const willRestart = this._restartCount <= Constants.MaxRestarts;
94
>
reportAgentHostProcessError(this._telemetryService, {
95
>
kind: 'unexpectedExit',
96
>
code: e.code,
97
>
restartCount: this._restartCount,
98
>
willRestart,
99
>
});
100
>
if (willRestart) {
101
>
this._logService.error(`ServerAgentHostManager: agent host terminated unexpectedly with code ${e.code}`);
102
>
this._restartCount++;
103
>
connection.store.dispose();
104
>
this._start();
105
>
} else {
106
this._logService.error(`ServerAgentHostManager: agent host terminated with code ${e.code}, giving up after ${Constants.MaxRestarts} restarts`);
107
}
109
}));
110