@@ -689,7 +689,7 @@ index 3715cbb8e6ee41c3d9b5090918d243b723ae2d00..c65de8ad37e727d66da97a8f8b170cbc
689
689
-
690
690
-
691
691
diff --git a/src/vs/platform/remote/common/remoteAgentConnection.ts b/src/vs/platform/remote/common/remoteAgentConnection.ts
692
- index 18d3d04fd20335975293e37b3b641120dd92da20..b9819d50683f40c41c8a3b1f71423a20916e8394 100644
692
+ index 18d3d04fd20335975293e37b3b641120dd92da20..a06f20ece490dba5d88b41268cddaaf6b2f6b64a 100644
693
693
--- a/src/vs/platform/remote/common/remoteAgentConnection.ts
694
694
+++ b/src/vs/platform/remote/common/remoteAgentConnection.ts
695
695
@@ -92,7 +92,7 @@ async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptio
@@ -701,12 +701,12 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..b9819d50683f40c41c8a3b1f71423a20
701
701
(err: any, socket: ISocket | undefined) => {
702
702
if (err || !socket) {
703
703
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
704
- @@ -331,12 +331,17 @@ export const enum PersistentConnectionEventType {
704
+ @@ -331,12 +331,16 @@ export const enum PersistentConnectionEventType {
705
705
}
706
706
export class ConnectionLostEvent {
707
707
public readonly type = PersistentConnectionEventType.ConnectionLost;
708
708
+ constructor(
709
- + public readonly suppressPopup ?: boolean
709
+ + public readonly connectionAttempt ?: number
710
710
+ ) { }
711
711
}
712
712
export class ReconnectionWaitEvent {
@@ -715,67 +715,68 @@ index 18d3d04fd20335975293e37b3b641120dd92da20..b9819d50683f40c41c8a3b1f71423a20
715
715
public readonly durationSeconds: number,
716
716
- private readonly cancellableTimer: CancelablePromise<void>
717
717
+ private readonly cancellableTimer: CancelablePromise<void>,
718
- + public readonly suppressPopup?: boolean,
719
- + public readonly forceDialog?: boolean
718
+ + public readonly connectionAttempt?: number,
720
719
) { }
721
720
722
721
public skipWait(): void {
723
- @@ -345,12 +350 ,21 @@ export class ReconnectionWaitEvent {
722
+ @@ -345,12 +349 ,21 @@ export class ReconnectionWaitEvent {
724
723
}
725
724
export class ReconnectionRunningEvent {
726
725
public readonly type = PersistentConnectionEventType.ReconnectionRunning;
727
726
+ constructor(
728
- + public readonly suppressPopup ?: boolean
727
+ + public readonly connectionAttempt ?: number
729
728
+ ) { }
730
729
}
731
730
export class ConnectionGainEvent {
732
731
public readonly type = PersistentConnectionEventType.ConnectionGain;
733
732
+ constructor(
734
- + public readonly suppressPopup ?: boolean
733
+ + public readonly connectionAttempt ?: number
735
734
+ ) { }
736
735
}
737
736
export class ReconnectionPermanentFailureEvent {
738
737
public readonly type = PersistentConnectionEventType.ReconnectionPermanentFailure;
739
738
+ constructor(
740
- + public readonly suppressPopup ?: boolean | undefined
739
+ + public readonly connectionAttempt ?: number
741
740
+ ) { }
742
741
}
743
742
export type PersistenConnectionEvent = ConnectionGainEvent | ConnectionLostEvent | ReconnectionWaitEvent | ReconnectionRunningEvent | ReconnectionPermanentFailureEvent;
744
743
745
- @@ -411,16 +425,22 @@ abstract class PersistentConnection extends Disposable {
744
+ @@ -411,8 +424,9 @@ abstract class PersistentConnection extends Disposable {
746
745
}
747
746
const logPrefix = commonLogPrefix(this._connectionType, this.reconnectionToken, true);
748
747
this._options.logService.info(`${logPrefix} starting reconnecting loop. You can get more information with the trace log level.`);
749
748
- this._onDidStateChange.fire(new ConnectionLostEvent());
750
- + let suppressPopup = true;
751
- + let forceDialog = false;
752
- + this._onDidStateChange.fire(new ConnectionLostEvent(suppressPopup));
749
+ + this._onDidStateChange.fire(new ConnectionLostEvent(0));
753
750
const TIMES = [5, 5, 10, 10, 10, 10, 10, 30];
754
- + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
755
751
+
756
752
const disconnectStartTime = Date.now();
757
753
let attempt = -1;
758
754
do {
759
- attempt++;
760
- + suppressPopup = (attempt < SHOW_POPUP_ON_ATTEMPT) ? true : false
761
- + forceDialog = (attempt == SHOW_POPUP_ON_ATTEMPT)
755
+ @@ -420,7 +434,7 @@ abstract class PersistentConnection extends Disposable {
762
756
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
763
757
try {
764
758
const sleepPromise = sleep(waitTime);
765
759
- this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise));
766
- + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, suppressPopup, forceDialog ));
760
+ + this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, attempt ));
767
761
768
762
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
769
763
try {
770
- @@ -433,7 +453,7 @@ abstract class PersistentConnection extends Disposable {
764
+ @@ -433,13 +447,13 @@ abstract class PersistentConnection extends Disposable {
771
765
}
772
766
773
767
// connection was lost, let's try to re-establish it
774
768
- this._onDidStateChange.fire(new ReconnectionRunningEvent());
775
- + this._onDidStateChange.fire(new ReconnectionRunningEvent(suppressPopup ));
769
+ + this._onDidStateChange.fire(new ReconnectionRunningEvent(attempt ));
776
770
this._options.logService.info(`${logPrefix} resolving connection...`);
777
771
const simpleOptions = await resolveConnectionOptions(this._options, this.reconnectionToken, this.protocol);
778
772
this._options.logService.info(`${logPrefix} connecting to ${simpleOptions.host}:${simpleOptions.port}...`);
773
+ await connectWithTimeLimit(simpleOptions.logService, this._reconnect(simpleOptions), RECONNECT_TIMEOUT);
774
+ this._options.logService.info(`${logPrefix} reconnected!`);
775
+ - this._onDidStateChange.fire(new ConnectionGainEvent());
776
+ + this._onDidStateChange.fire(new ConnectionGainEvent(attempt));
777
+
778
+ break;
779
+ } catch (err) {
779
780
diff --git a/src/vs/platform/storage/browser/storageService.ts b/src/vs/platform/storage/browser/storageService.ts
780
781
index ab3fd347b69f8a3d9b96e706cd87c911b8ffed6b..9d351037b577f9f1edfd18ae9b3c48a211f4467f 100644
781
782
--- a/src/vs/platform/storage/browser/storageService.ts
@@ -3275,16 +3276,28 @@ index 94e7e7a4bac154c45078a1b5034e50634a7a43af..8164200dcef1efbc65b50eef9c270af3
3275
3276
this._dirnameKey.set(value ? dirname(value).fsPath : null);
3276
3277
this._pathKey.set(value ? value.fsPath : null);
3277
3278
diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts
3278
- index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670c5b43074 100644
3279
+ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..1430666aa94f941bda086df503fec8b35aa2b25f 100644
3279
3280
--- a/src/vs/workbench/contrib/remote/browser/remote.ts
3280
3281
+++ b/src/vs/workbench/contrib/remote/browser/remote.ts
3281
- @@ -795,31 +795,43 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3282
+ @@ -730,6 +730,7 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3283
+ @IContextKeyService contextKeyService: IContextKeyService
3284
+ ) {
3285
+ const connection = remoteAgentService.getConnection();
3286
+ + const SHOW_POPUP_ON_ATTEMPT = 2 // aka third attempt
3287
+ if (connection) {
3288
+ let visibleProgress: VisibleProgress | null = null;
3289
+ let lastLocation: ProgressLocation.Dialog | ProgressLocation.Notification | null = null;
3290
+ @@ -793,33 +794,47 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution {
3291
+ disposableListener.dispose();
3292
+ disposableListener = null;
3282
3293
}
3294
+ + let suppressPopup = (typeof e.connectionAttempt == 'number' && e.connectionAttempt < SHOW_POPUP_ON_ATTEMPT)
3295
+ + let forceDialog = (typeof e.connectionAttempt == 'number' && e.connectionAttempt == SHOW_POPUP_ON_ATTEMPT)
3283
3296
switch (e.type) {
3284
3297
case PersistentConnectionEventType.ConnectionLost:
3285
3298
- if (!visibleProgress) {
3286
3299
- visibleProgress = showProgress(ProgressLocation.Dialog, [reconnectButton, reloadButton]);
3287
- + if (e. suppressPopup) {
3300
+ + if (suppressPopup) {
3288
3301
+ hideProgress()
3289
3302
+ } else {
3290
3303
+ if (!visibleProgress) {
@@ -3298,10 +3311,10 @@ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670
3298
3311
reconnectWaitEvent = e;
3299
3312
- visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reconnectButton, reloadButton]);
3300
3313
- visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3301
- + if (e. suppressPopup) {
3314
+ + if (suppressPopup) {
3302
3315
+ hideProgress()
3303
3316
+ } else {
3304
- + const location = e. forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3317
+ + const location = forceDialog ? ProgressLocation.Dialog : (lastLocation || ProgressLocation.Notification)
3305
3318
+ visibleProgress = showProgress(location, [reconnectButton, reloadButton]);
3306
3319
+ visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
3307
3320
+ }
@@ -3317,7 +3330,7 @@ index 98573a206f14928fc3fdf18fe927cb75034e4ad1..a031f76924abf8f10c510ea9c043f670
3317
3330
- // Need to move from dialog if being shown and user needs to type in a prompt
3318
3331
- if (lastLocation === ProgressLocation.Dialog && visibleProgress !== null) {
3319
3332
- visibleProgress = showProgress(ProgressLocation.Notification, [reloadButton], visibleProgress.lastReport);
3320
- + if (e. suppressPopup) {
3333
+ + if (suppressPopup) {
3321
3334
+ hideProgress()
3322
3335
+ } else {
3323
3336
+ visibleProgress = showProgress(lastLocation || ProgressLocation.Notification, [reloadButton]);
0 commit comments