File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -3242,29 +3242,28 @@ internal void ReadSni(TaskCompletionSource<object> completion)
32423242
32433243 readPacket = ReadAsync ( handle , out error ) ;
32443244
3245- if ( ! ( TdsEnums . SNI_SUCCESS == error || TdsEnums . SNI_SUCCESS_IO_PENDING == error ) )
3246- {
3247- DecrementPendingCallbacks ( false ) ; // Failure - we won't receive callback!
3248- }
3245+ if ( ! ( TdsEnums . SNI_SUCCESS == error || TdsEnums . SNI_SUCCESS_IO_PENDING == error ) )
3246+ {
3247+ DecrementPendingCallbacks ( false ) ; // Failure - we won't receive callback!
32493248 }
32503249 }
3251- else
3252- {
3253- // this call to IncrementPendingCallbacks is required for balance
3254- // the _pendingCallbacks counter will be unconditionally decremented in ReadAsyncCallback
3255- // so we must make sure that even though we are not making a network call that we do
3256- // not cause an incorrect decrement which will cause disconnection from the native
3257- // component
3258- IncrementPendingCallbacks ( ) ;
3259- readPacket = default ;
3260- error = TdsEnums . SNI_SUCCESS ;
3261- }
32623250 }
3263- finally
3251+ else
32643252 {
3265- Interlocked . Decrement ( ref _readingCount ) ;
3253+ // this call to IncrementPendingCallbacks is required for balance
3254+ // the _pendingCallbacks counter will be unconditionally decremented in ReadAsyncCallback
3255+ // so we must make sure that even though we are not making a network call that we do
3256+ // not cause an incorrect decrement which will cause disconnection from the native
3257+ // component
3258+ IncrementPendingCallbacks ( ) ;
3259+ readPacket = default ;
3260+ error = TdsEnums . SNI_SUCCESS ;
32663261 }
32673262 }
3263+ finally
3264+ {
3265+ Interlocked . Decrement ( ref _readingCount ) ;
3266+ }
32683267
32693268 if ( handle . IsNull )
32703269 {
You can’t perform that action at this time.
0 commit comments