protected override void Dispose(bool disposing) { // Do not call base.Dispose. We do not want the AsyncSemaphore instances to be disposed due to a race // condition. if (disposing) { ReceivingStream?.Dispose(); SendingStream?.Dispose(); } }
protected override void Dispose(bool disposing) { // Do not call base.Dispose. We do not want the AsyncSemaphore instances to be disposed due to a race // condition. if (disposing) { // note that this can cause double disposing of a stream if both are based on same stream. // we can't check whether 2 are same because one of them could be wrapped stream such as bufferedstream which // underneath points to same stream. ReceivingStream?.Dispose(); SendingStream?.Dispose(); } }