protected virtual void Dispose(bool disposing, CloseExState closeState) {
// All below calls should already be idempotent
try {
if (!m_HeadEOF) {
ICloseEx icloseEx = m_HeadStream as ICloseEx;
if (icloseEx != null) {
icloseEx.CloseEx(closeState);
}
else {
m_HeadStream.Close();
}
}
}
finally {
ICloseEx icloseEx = m_TailStream as ICloseEx;
if (icloseEx != null) {
icloseEx.CloseEx(closeState);
}
else {
m_TailStream.Close();
}
}
if (!disposing) {
m_HeadStream = null;
m_TailStream = null;
}
}