fix: conflicts with remoteAgentConnection
As Asher pointed out, looks like it makes #2381 obsolete. Hope this all works.
This commit is contained in:
parent
f214235e2d
commit
502323a9c8
|
@ -86,23 +86,6 @@ export interface ISocketFactory {
|
||||||
connect(host: string, port: number, query: string, callback: IConnectCallback): void;
|
connect(host: string, port: number, query: string, callback: IConnectCallback): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
async function connectToRemoteExtensionHostAgent(options: ISimpleConnectionOptions, connectionType: ConnectionType, args: any | undefined): Promise<{ protocol: PersistentProtocol; ownsProtocol: boolean; }> {
|
|
||||||
const logPrefix = connectLogPrefix(options, connectionType);
|
|
||||||
const { protocol, ownsProtocol } = await new Promise<{ protocol: PersistentProtocol; ownsProtocol: boolean; }>((c, e) => {
|
|
||||||
options.logService.trace(`${logPrefix} 1/6. invoking socketFactory.connect().`);
|
|
||||||
options.socketFactory.connect(
|
|
||||||
options.host,
|
|
||||||
options.port,
|
|
||||||
`type=${connectionTypeToString(connectionType)}&reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`,
|
|
||||||
(err: any, socket: ISocket | undefined) => {
|
|
||||||
if (err || !socket) {
|
|
||||||
options.logService.error(`${logPrefix} socketFactory.connect() failed. Error:`);
|
|
||||||
options.logService.error(err);
|
|
||||||
e(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
async function readOneControlMessage<T>(protocol: PersistentProtocol): Promise<T> {
|
async function readOneControlMessage<T>(protocol: PersistentProtocol): Promise<T> {
|
||||||
const raw = await Event.toPromise(protocol.onControlMessage);
|
const raw = await Event.toPromise(protocol.onControlMessage);
|
||||||
const msg = JSON.parse(raw.toString());
|
const msg = JSON.parse(raw.toString());
|
||||||
|
@ -112,7 +95,6 @@ async function readOneControlMessage<T>(protocol: PersistentProtocol): Promise<T
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
>>>>>>> 89b6e0164fa770333755b11504e19a4232b1a2d4
|
|
||||||
|
|
||||||
function waitWithTimeout<T>(promise: Promise<T>, timeout: number): Promise<T> {
|
function waitWithTimeout<T>(promise: Promise<T>, timeout: number): Promise<T> {
|
||||||
return new Promise<T>((resolve, reject) => {
|
return new Promise<T>((resolve, reject) => {
|
||||||
|
@ -496,25 +478,15 @@ abstract class PersistentConnection extends Disposable {
|
||||||
attempt++;
|
attempt++;
|
||||||
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
|
const waitTime = (attempt < TIMES.length ? TIMES[attempt] : TIMES[TIMES.length - 1]);
|
||||||
try {
|
try {
|
||||||
<<<<<<< HEAD
|
|
||||||
const sleepPromise = sleep(waitTime);
|
|
||||||
this._onDidStateChange.fire(new ReconnectionWaitEvent(waitTime, sleepPromise, attempt+1));
|
|
||||||
|
|
||||||
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
|
|
||||||
try {
|
|
||||||
await sleepPromise;
|
|
||||||
} catch { } // User canceled timer
|
|
||||||
=======
|
|
||||||
if (waitTime > 0) {
|
if (waitTime > 0) {
|
||||||
const sleepPromise = sleep(waitTime);
|
const sleepPromise = sleep(waitTime);
|
||||||
this._onDidStateChange.fire(new ReconnectionWaitEvent(this.reconnectionToken, this.protocol.getMillisSinceLastIncomingData(), waitTime, sleepPromise));
|
this._onDidStateChange.fire(new ReconnectionWaitEvent(this.reconnectionToken, this.protocol.getMillisSinceLastIncomingData(), waitTime, sleepPromise, attempt));
|
||||||
|
|
||||||
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
|
this._options.logService.info(`${logPrefix} waiting for ${waitTime} seconds before reconnecting...`);
|
||||||
try {
|
try {
|
||||||
await sleepPromise;
|
await sleepPromise;
|
||||||
} catch { } // User canceled timer
|
} catch { } // User canceled timer
|
||||||
}
|
}
|
||||||
>>>>>>> 89b6e0164fa770333755b11504e19a4232b1a2d4
|
|
||||||
|
|
||||||
if (PersistentConnection._permanentFailure) {
|
if (PersistentConnection._permanentFailure) {
|
||||||
this._options.logService.error(`${logPrefix} permanent failure occurred while running the reconnecting loop.`);
|
this._options.logService.error(`${logPrefix} permanent failure occurred while running the reconnecting loop.`);
|
||||||
|
|
Loading…
Reference in New Issue