@@ -144,13 +144,13 @@ class ThinPoolImpl extends PoolImpl {
144144 }
145145
146146 //---------------------------------------------------------------------------
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
148150 //---------------------------------------------------------------------------
149- async _connect ( connAttrs ) {
151+ async _getConnAttrs ( ) {
150152 let accessToken ;
151- const conn = new ThinConnectionImpl ( ) ;
152- conn . _pool = this ;
153- let clonedAttrs = Object . assign ( { } , connAttrs ) ;
153+ const clonedAttrs = Object . assign ( { } , this . _userConfig ) ;
154154 if ( clonedAttrs . password === null ) {
155155 clonedAttrs . password = protocolUtil . getDeobfuscatedValue ( this . _password ,
156156 this . _obfuscatedPassword ) ;
@@ -204,9 +204,7 @@ class ThinPoolImpl extends PoolImpl {
204204 protocolUtil . getDeobfuscatedValue ( this . _privateKey ,
205205 this . _obfuscatedPrivateKey ) ;
206206 }
207- await conn . connect ( clonedAttrs ) ;
208- clonedAttrs = null ;
209- return conn ;
207+ return clonedAttrs ;
210208 }
211209
212210 //---------------------------------------------------------------------------
@@ -318,8 +316,11 @@ class ThinPoolImpl extends PoolImpl {
318316 // Grows the pool to include the specified number of connections.
319317 //---------------------------------------------------------------------------
320318 async _growPool ( numConns ) {
319+ const clonedAttrs = await this . _getConnAttrs ( ) ;
321320 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 ) ;
323324 conn . _newSession = true ;
324325 conn . _dropSess = false ;
325326 conn . _lastTimeUsed = Date . now ( ) ;
0 commit comments