@@ -214,11 +214,15 @@ export class ClientEncryption {
214214 keyMaterial
215215 } ) ;
216216
217- const stateMachine = new StateMachine ( {
218- proxyOptions : this . _proxyOptions ,
219- tlsOptions : this . _tlsOptions ,
220- socketOptions : autoSelectSocketOptions ( this . _client . s . options )
221- } ) ;
217+ const stateMachine = new StateMachine (
218+ {
219+ proxyOptions : this . _proxyOptions ,
220+ tlsOptions : this . _tlsOptions ,
221+ socketOptions : autoSelectSocketOptions ( this . _client . s . options )
222+ } ,
223+ undefined ,
224+ this . _client . closeSignal
225+ ) ;
222226
223227 const timeoutContext =
224228 options ?. timeoutContext ??
@@ -283,11 +287,15 @@ export class ClientEncryption {
283287 }
284288 const filterBson = serialize ( filter ) ;
285289 const context = this . _mongoCrypt . makeRewrapManyDataKeyContext ( filterBson , keyEncryptionKeyBson ) ;
286- const stateMachine = new StateMachine ( {
287- proxyOptions : this . _proxyOptions ,
288- tlsOptions : this . _tlsOptions ,
289- socketOptions : autoSelectSocketOptions ( this . _client . s . options )
290- } ) ;
290+ const stateMachine = new StateMachine (
291+ {
292+ proxyOptions : this . _proxyOptions ,
293+ tlsOptions : this . _tlsOptions ,
294+ socketOptions : autoSelectSocketOptions ( this . _client . s . options )
295+ } ,
296+ undefined ,
297+ this . _client . closeSignal
298+ ) ;
291299
292300 const timeoutContext = TimeoutContext . create (
293301 resolveTimeoutOptions ( this . _client , { timeoutMS : this . _timeoutMS } )
@@ -687,11 +695,15 @@ export class ClientEncryption {
687695 const valueBuffer = serialize ( { v : value } ) ;
688696 const context = this . _mongoCrypt . makeExplicitDecryptionContext ( valueBuffer ) ;
689697
690- const stateMachine = new StateMachine ( {
691- proxyOptions : this . _proxyOptions ,
692- tlsOptions : this . _tlsOptions ,
693- socketOptions : autoSelectSocketOptions ( this . _client . s . options )
694- } ) ;
698+ const stateMachine = new StateMachine (
699+ {
700+ proxyOptions : this . _proxyOptions ,
701+ tlsOptions : this . _tlsOptions ,
702+ socketOptions : autoSelectSocketOptions ( this . _client . s . options )
703+ } ,
704+ undefined ,
705+ this . _client . closeSignal
706+ ) ;
695707
696708 const timeoutContext =
697709 this . _timeoutMS != null
@@ -712,7 +724,7 @@ export class ClientEncryption {
712724 * the original ones.
713725 */
714726 async askForKMSCredentials ( ) : Promise < KMSProviders > {
715- return await refreshKMSCredentials ( this . _kmsProviders ) ;
727+ return await refreshKMSCredentials ( this . _kmsProviders , this . _client . closeSignal ) ;
716728 }
717729
718730 static get libmongocryptVersion ( ) {
@@ -771,11 +783,15 @@ export class ClientEncryption {
771783 }
772784
773785 const valueBuffer = serialize ( { v : value } ) ;
774- const stateMachine = new StateMachine ( {
775- proxyOptions : this . _proxyOptions ,
776- tlsOptions : this . _tlsOptions ,
777- socketOptions : autoSelectSocketOptions ( this . _client . s . options )
778- } ) ;
786+ const stateMachine = new StateMachine (
787+ {
788+ proxyOptions : this . _proxyOptions ,
789+ tlsOptions : this . _tlsOptions ,
790+ socketOptions : autoSelectSocketOptions ( this . _client . s . options )
791+ } ,
792+ undefined ,
793+ this . _client . closeSignal
794+ ) ;
779795 const context = this . _mongoCrypt . makeExplicitEncryptionContext ( valueBuffer , contextOptions ) ;
780796
781797 const timeoutContext =
0 commit comments