@@ -59,23 +59,29 @@ class ThinConnectionImpl extends ConnectionImpl {
5959 * @return {Promise }
6060 */
6161 async close ( ) {
62- if ( this . _protocol . txnInProgress ) {
63- await this . rollback ( ) ;
64- }
65- this . _protocol . callTimeout = 0 ; // not applicable for close
66- if ( this . _drcpEnabled ) {
67- await this . _sessRelease ( ) ;
68- this . _drcpEstablishSession = true ;
69- }
62+ try {
63+ if ( this . _protocol . txnInProgress ) {
64+ await this . rollback ( ) ;
65+ }
66+ this . _protocol . callTimeout = 0 ; // not applicable for close
67+ if ( this . _drcpEnabled ) {
68+ await this . _sessRelease ( ) ;
69+ this . _drcpEstablishSession = true ;
70+ }
7071
71- if ( this . _pool && ! this . _dropSess ) {
72- await this . _pool . release ( this ) ;
73- } else {
74- if ( ! this . _drcpEnabled ) {
75- const message = new messages . LogOffMessage ( this ) ;
76- await this . _protocol . _processMessage ( message ) ;
72+ if ( this . _pool && ! this . _dropSess ) {
73+ await this . _pool . release ( this ) ;
74+ } else {
75+ if ( ! this . _drcpEnabled ) {
76+ const message = new messages . LogOffMessage ( this ) ;
77+ await this . _protocol . _processMessage ( message ) ;
78+ }
79+ this . nscon . disconnect ( ) ;
7780 }
78- this . nscon . disconnect ( ) ;
81+ } catch ( err ) {
82+ // immediate close of open socket on failure
83+ // exception won't be thrown to user
84+ this . nscon . disconnect ( sqlNetConstants . NSFIMM ) ;
7985 }
8086 }
8187
0 commit comments