@@ -689,7 +689,7 @@ index 3715cbb8e6ee41c3d9b5090918d243b723ae2d00..c65de8ad37e727d66da97a8f8b170cbc
689689-
690690-
691691diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts
692- index 18d3d04fd20335975293e37b3b641120dd92da20..4e49f9d63623da6c84624144765f76ec127ea526 100644
692+ index 18d3d04fd20335975293e37b3b641120dd92da20..e072fc38ccd950462f42fdf112c8e7e673f351f5 100644
693693--- a/src/vs/platform/remote/common/remoteAgentConnection.ts
694694+++ b/src/vs/platform/remote/common/remoteAgentConnection.ts
695695@@ -92,7 +92,7 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio
@@ -701,6 +701,53 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..4e49f9d63623da6c84624144765f76ec
701701 (err: any, socket: ISocket | undefined) => {
702702 if (err || !socket) {
703703 options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
704+ @@ -411,16 +411,23 @@ abstract class PersistentConnection extends Disposable {
705+ }
706+ const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
707+ this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
708+ - this._onDidStateChange.fire(new ConnectionLostEvent());
709+ const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
710+ + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
711+ +
712+ const disconnectStartTime = Date.now();
713+ let attempt = -1;
714+ do {
715+ attempt++;
716+ + if (attempt == SHOW_POPUP_ON_ATTEMPT){
717+ + this._onDidStateChange.fire(new ConnectionLostEvent());
718+ + }
719+ +
720+ const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
721+ try {
722+ const sleepPromise = sleep(waitTime);
723+ - this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
724+ + if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
725+ + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
726+ + }
727+
728+ this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
729+ try {
730+ @@ -433,14 +440,17 @@ abstract class PersistentConnection extends Disposable {
731+ }
732+
733+ // connection was lost, let's try to re-establish it
734+ - this._onDidStateChange.fire(new ReconnectionRunningEvent());
735+ + if (attempt >= SHOW_POPUP_ON_ATTEMPT){
736+ + this._onDidStateChange.fire(new ReconnectionRunningEvent());
737+ + }
738+ this._options.logService.info(`${logPrefix} resolving connection...`);
739+ const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
740+ this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
741+ await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
742+ this._options.logService.info(`${logPrefix} reconnected!`);
743+ - this._onDidStateChange.fire(new ConnectionGainEvent());
744+ -
745+ + if (attempt >= SHOW_POPUP_ON_ATTEMPT) {
746+ + this._onDidStateChange.fire(new ConnectionGainEvent());
747+ + }
748+ break;
749+ } catch (err) {
750+ if (err.code === 'VSCODE_CONNECTION_ERROR') {
704751diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
705752index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
706753--- a/src/vs/platform/storage/browser/storageService.ts
0 commit comments