@@ -86,23 +86,6 @@ export interface ISocketFactory {
8686 connect ( host : string , port : number , query : string , callback : IConnectCallback ) : void ;
8787}
8888
89- < < < << << HEAD
90- async function connectToRemoteExtensionHostAgent ( options : ISimpleConnectionOptions , connectionType : ConnectionType , args : any | undefined ) : Promise < { protocol : PersistentProtocol ; ownsProtocol : boolean ; } > {
91- const logPrefix = connectLogPrefix ( options , connectionType ) ;
92- const { protocol, ownsProtocol } = await new Promise < { protocol : PersistentProtocol ; ownsProtocol : boolean ; } > ( ( c , e ) => {
93- options . logService . trace ( `${ logPrefix } 1/6. invoking socketFactory.connect().` ) ;
94- options . socketFactory . connect (
95- options . host ,
96- options . port ,
97- `type=${ connectionTypeToString ( connectionType ) } &reconnectionToken=${ options . reconnectionToken } &reconnection=${ options . reconnectionProtocol ? 'true' : 'false' } ` ,
98- ( err : any , socket : ISocket | undefined ) => {
99- if ( err || ! socket ) {
100- options . logService . error ( `${ logPrefix } socketFactory.connect() failed. Error:` ) ;
101- options . logService . error ( err ) ;
102- e ( err ) ;
103- return ;
104- }
105- = === ===
10689async function readOneControlMessage < T > ( protocol : PersistentProtocol ) : Promise < T > {
10790 const raw = await Event . toPromise ( protocol . onControlMessage ) ;
10891 const msg = JSON . parse ( raw . toString ( ) ) ;
@@ -112,7 +95,6 @@ async function readOneControlMessage<T>(protocol: PersistentProtocol): Promise<T
11295 }
11396 return msg ;
11497}
115- >>> > >>> 89 b6e0164fa770333755b11504e19a4232b1a2d4
11698
11799function waitWithTimeout < T > ( promise : Promise < T > , timeout : number ) : Promise < T > {
118100 return new Promise < T > ( ( resolve , reject ) => {
@@ -496,25 +478,15 @@ abstract class PersistentConnection extends Disposable {
496478 attempt ++ ;
497479 const waitTime = ( attempt < TIMES . length ? TIMES [ attempt ] : TIMES [ TIMES . length - 1 ] ) ;
498480 try {
499- < < < << << HEAD
500- const sleepPromise = sleep ( waitTime ) ;
501- this . _onDidStateChange . fire ( new ReconnectionWaitEvent ( waitTime , sleepPromise , attempt + 1 ) ) ;
502-
503- this . _options . logService . info ( `${ logPrefix } waiting for ${ waitTime } seconds before reconnecting...` ) ;
504- try {
505- await sleepPromise ;
506- } catch { } // User canceled timer
507- = === ===
508481 if ( waitTime > 0 ) {
509482 const sleepPromise = sleep ( waitTime ) ;
510- this . _onDidStateChange . fire ( new ReconnectionWaitEvent ( this . reconnectionToken , this . protocol . getMillisSinceLastIncomingData ( ) , waitTime , sleepPromise ) ) ;
483+ this . _onDidStateChange . fire ( new ReconnectionWaitEvent ( this . reconnectionToken , this . protocol . getMillisSinceLastIncomingData ( ) , waitTime , sleepPromise , attempt ) ) ;
511484
512485 this . _options . logService . info ( `${ logPrefix } waiting for ${ waitTime } seconds before reconnecting...` ) ;
513486 try {
514487 await sleepPromise ;
515488 } catch { } // User canceled timer
516489 }
517- > >>> >>> 89 b6e0164fa770333755b11504e19a4232b1a2d4
518490
519491 if ( PersistentConnection . _permanentFailure ) {
520492 this . _options . logService . error ( `${ logPrefix } permanent failure occurred while running the reconnecting loop.` ) ;
0 commit comments