@@ -62,7 +62,6 @@ export interface FileWatcherCertificateProviderConfig {
6262
6363export class FileWatcherCertificateProvider implements CertificateProvider {
6464 private refreshTimer : NodeJS . Timeout | null = null ;
65- private fileReadCanceller : AbortController | null = null ;
6665 private fileResultPromise : Promise < [ PromiseSettledResult < Buffer > , PromiseSettledResult < Buffer > , PromiseSettledResult < Buffer > ] > | null = null ;
6766 private latestCaUpdate : CaCertificateUpdate | null = null ;
6867 private caListeners : Set < CaCertificateUpdateListener > = new Set ( ) ;
@@ -86,20 +85,18 @@ export class FileWatcherCertificateProvider implements CertificateProvider {
8685 if ( this . fileResultPromise ) {
8786 return ;
8887 }
89- this . fileReadCanceller = new AbortController ( ) ;
9088 this . fileResultPromise = Promise . allSettled ( [
91- this . config . certificateFile ? fs . readFile ( this . config . certificateFile , { signal : this . fileReadCanceller . signal } ) : Promise . reject < Buffer > ( ) ,
92- this . config . privateKeyFile ? fs . readFile ( this . config . privateKeyFile , { signal : this . fileReadCanceller . signal } ) : Promise . reject < Buffer > ( ) ,
93- this . config . caCertificateFile ? fs . readFile ( this . config . caCertificateFile , { signal : this . fileReadCanceller . signal } ) : Promise . reject < Buffer > ( )
89+ this . config . certificateFile ? fs . readFile ( this . config . certificateFile ) : Promise . reject < Buffer > ( ) ,
90+ this . config . privateKeyFile ? fs . readFile ( this . config . privateKeyFile ) : Promise . reject < Buffer > ( ) ,
91+ this . config . caCertificateFile ? fs . readFile ( this . config . caCertificateFile ) : Promise . reject < Buffer > ( )
9492 ] ) ;
9593 this . fileResultPromise . then ( ( [ certificateResult , privateKeyResult , caCertificateResult ] ) => {
96- if ( this . fileReadCanceller ?. signal . aborted ) {
94+ if ( ! this . refreshTimer ) {
9795 return ;
9896 }
9997 trace ( 'File watcher read certificates certificate' + ( certificateResult ? '!=' : '==' ) + 'null, privateKey' + ( privateKeyResult ? '!=' : '==' ) + 'null, CA certificate' + ( caCertificateResult ? '!=' : '==' ) + 'null' ) ;
10098 this . lastUpdateTime = new Date ( ) ;
10199 this . fileResultPromise = null ;
102- this . fileReadCanceller = null ;
103100 if ( certificateResult . status === 'fulfilled' && privateKeyResult . status === 'fulfilled' ) {
104101 this . latestIdentityUpdate = {
105102 certificate : certificateResult . value ,
@@ -145,7 +142,6 @@ export class FileWatcherCertificateProvider implements CertificateProvider {
145142
146143 private maybeStopWatchingFiles ( ) {
147144 if ( this . caListeners . size === 0 && this . identityListeners . size === 0 ) {
148- this . fileReadCanceller ?. abort ( ) ;
149145 this . fileResultPromise = null ;
150146 if ( this . refreshTimer ) {
151147 clearInterval ( this . refreshTimer ) ;
0 commit comments