@@ -86,23 +86,6 @@ export interface ISocketFactory {
86
86
connect ( host : string , port : number , query : string , callback : IConnectCallback ) : void ;
87
87
}
88
88
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
- = === ===
106
89
async function readOneControlMessage < T > ( protocol : PersistentProtocol ) : Promise < T > {
107
90
const raw = await Event . toPromise ( protocol . onControlMessage ) ;
108
91
const msg = JSON . parse ( raw . toString ( ) ) ;
@@ -112,7 +95,6 @@ async function readOneControlMessage<T>(protocol: PersistentProtocol): Promise<T
112
95
}
113
96
return msg ;
114
97
}
115
- >>> > >>> 89 b6e0164fa770333755b11504e19a4232b1a2d4
116
98
117
99
function waitWithTimeout < T > ( promise : Promise < T > , timeout : number ) : Promise < T > {
118
100
return new Promise < T > ( ( resolve , reject ) => {
@@ -496,25 +478,15 @@ abstract class PersistentConnection extends Disposable {
496
478
attempt ++ ;
497
479
const waitTime = ( attempt < TIMES . length ? TIMES [ attempt ] : TIMES [ TIMES . length - 1 ] ) ;
498
480
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
- = === ===
508
481
if ( waitTime > 0 ) {
509
482
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 ) ) ;
511
484
512
485
this . _options . logService . info ( `${ logPrefix } waiting for ${ waitTime } seconds before reconnecting...` ) ;
513
486
try {
514
487
await sleepPromise ;
515
488
} catch { } // User canceled timer
516
489
}
517
- > >>> >>> 89 b6e0164fa770333755b11504e19a4232b1a2d4
518
490
519
491
if ( PersistentConnection . _permanentFailure ) {
520
492
this . _options . logService . error ( `${ logPrefix } permanent failure occurred while running the reconnecting loop.` ) ;
0 commit comments