File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2128,11 +2128,11 @@ protected override void OnDisconnecting()
2128
2128
2129
2129
// disconnect, dispose and dereference the SFTP session since we create a new SFTP session
2130
2130
// on each connect
2131
- if ( _sftpSession != null )
2131
+ var sftpSession = _sftpSession ;
2132
+ if ( sftpSession != null )
2132
2133
{
2133
- _sftpSession . Disconnect ( ) ;
2134
- _sftpSession . Dispose ( ) ;
2135
2134
_sftpSession = null ;
2135
+ sftpSession . Dispose ( ) ;
2136
2136
}
2137
2137
}
2138
2138
@@ -2146,10 +2146,11 @@ protected override void Dispose(bool disposing)
2146
2146
2147
2147
if ( disposing )
2148
2148
{
2149
- if ( _sftpSession != null )
2149
+ var sftpSession = _sftpSession ;
2150
+ if ( sftpSession != null )
2150
2151
{
2151
- _sftpSession . Dispose ( ) ;
2152
2152
_sftpSession = null ;
2153
+ sftpSession . Dispose ( ) ;
2153
2154
}
2154
2155
}
2155
2156
}
You can’t perform that action at this time.
0 commit comments