@@ -144,13 +144,13 @@ class ThinPoolImpl extends PoolImpl {
144
144
}
145
145
146
146
//---------------------------------------------------------------------------
147
- // get connection from pool
147
+ // credentials are obfuscated and stored in an object(userConfig) during
148
+ // pool creation. _getConnAttrs() method is used to deobfuscate encrypted
149
+ // credentials for creating new connections
148
150
//---------------------------------------------------------------------------
149
- async _connect ( connAttrs ) {
151
+ async _getConnAttrs ( ) {
150
152
let accessToken ;
151
- const conn = new ThinConnectionImpl ( ) ;
152
- conn . _pool = this ;
153
- let clonedAttrs = Object . assign ( { } , connAttrs ) ;
153
+ const clonedAttrs = Object . assign ( { } , this . _userConfig ) ;
154
154
if ( clonedAttrs . password === null ) {
155
155
clonedAttrs . password = protocolUtil . getDeobfuscatedValue ( this . _password ,
156
156
this . _obfuscatedPassword ) ;
@@ -204,9 +204,7 @@ class ThinPoolImpl extends PoolImpl {
204
204
protocolUtil . getDeobfuscatedValue ( this . _privateKey ,
205
205
this . _obfuscatedPrivateKey ) ;
206
206
}
207
- await conn . connect ( clonedAttrs ) ;
208
- clonedAttrs = null ;
209
- return conn ;
207
+ return clonedAttrs ;
210
208
}
211
209
212
210
//---------------------------------------------------------------------------
@@ -318,8 +316,11 @@ class ThinPoolImpl extends PoolImpl {
318
316
// Grows the pool to include the specified number of connections.
319
317
//---------------------------------------------------------------------------
320
318
async _growPool ( numConns ) {
319
+ const clonedAttrs = await this . _getConnAttrs ( ) ;
321
320
while ( numConns > 0 ) {
322
- let conn = await this . _connect ( this . _userConfig ) ;
321
+ const conn = new ThinConnectionImpl ( ) ;
322
+ conn . _pool = this ;
323
+ await conn . connect ( clonedAttrs ) ;
323
324
conn . _newSession = true ;
324
325
conn . _dropSess = false ;
325
326
conn . _lastTimeUsed = Date . now ( ) ;
0 commit comments