@@ -62,7 +62,6 @@ export interface FileWatcherCertificateProviderConfig {
62
62
63
63
export class FileWatcherCertificateProvider implements CertificateProvider {
64
64
private refreshTimer : NodeJS . Timeout | null = null ;
65
- private fileReadCanceller : AbortController | null = null ;
66
65
private fileResultPromise : Promise < [ PromiseSettledResult < Buffer > , PromiseSettledResult < Buffer > , PromiseSettledResult < Buffer > ] > | null = null ;
67
66
private latestCaUpdate : CaCertificateUpdate | null = null ;
68
67
private caListeners : Set < CaCertificateUpdateListener > = new Set ( ) ;
@@ -86,20 +85,18 @@ export class FileWatcherCertificateProvider implements CertificateProvider {
86
85
if ( this . fileResultPromise ) {
87
86
return ;
88
87
}
89
- this . fileReadCanceller = new AbortController ( ) ;
90
88
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 > ( )
94
92
] ) ;
95
93
this . fileResultPromise . then ( ( [ certificateResult , privateKeyResult , caCertificateResult ] ) => {
96
- if ( this . fileReadCanceller ?. signal . aborted ) {
94
+ if ( ! this . refreshTimer ) {
97
95
return ;
98
96
}
99
97
trace ( 'File watcher read certificates certificate' + ( certificateResult ? '!=' : '==' ) + 'null, privateKey' + ( privateKeyResult ? '!=' : '==' ) + 'null, CA certificate' + ( caCertificateResult ? '!=' : '==' ) + 'null' ) ;
100
98
this . lastUpdateTime = new Date ( ) ;
101
99
this . fileResultPromise = null ;
102
- this . fileReadCanceller = null ;
103
100
if ( certificateResult . status === 'fulfilled' && privateKeyResult . status === 'fulfilled' ) {
104
101
this . latestIdentityUpdate = {
105
102
certificate : certificateResult . value ,
@@ -145,7 +142,6 @@ export class FileWatcherCertificateProvider implements CertificateProvider {
145
142
146
143
private maybeStopWatchingFiles ( ) {
147
144
if ( this . caListeners . size === 0 && this . identityListeners . size === 0 ) {
148
- this . fileReadCanceller ?. abort ( ) ;
149
145
this . fileResultPromise = null ;
150
146
if ( this . refreshTimer ) {
151
147
clearInterval ( this . refreshTimer ) ;
0 commit comments