void ICloseEx.CloseEx(CloseExState closeState) { if (GlobalLog.IsEnabled) { GlobalLog.Print("FtpDataStream#" + LoggingHash.HashString(this) + "::CloseEx, state = " + closeState.ToString()); } lock (this) { if (_closing == true) return; _closing = true; _writeable = false; _readable = false; } try { try { if ((closeState & CloseExState.Abort) == 0) _networkStream.Close(DefaultCloseTimeout); else _networkStream.Close(0); } finally { _request.DataStreamClosed(closeState); } } catch (Exception exception) { bool doThrow = true; WebException webException = exception as WebException; if (webException != null) { FtpWebResponse response = webException.Response as FtpWebResponse; if (response != null) { if (!_isFullyRead && response.StatusCode == FtpStatusCode.ConnectionClosed) doThrow = false; } } if (doThrow) if ((closeState & CloseExState.Silent) == 0) throw; } }
void ICloseEx.CloseEx(CloseExState closeState) { GlobalLog.Print("FtpDataStream#" + ValidationHelper.HashString(this) + "::CloseEx, state = " + closeState.ToString()); lock (this) { if (m_Closing == true) return; m_Closing = true; m_Writeable = false; m_Readable = false; } try { try { if ((closeState & CloseExState.Abort) == 0) m_NetworkStream.Close(Socket.DefaultCloseTimeout); else m_NetworkStream.Close(0); } finally { m_Request.DataStreamClosed(closeState); } } catch (Exception exception) { bool doThrow = true; WebException webException = exception as WebException; if (webException != null) { FtpWebResponse response = webException.Response as FtpWebResponse; if (response != null) { if (!m_IsFullyRead && response.StatusCode == FtpStatusCode.ConnectionClosed) doThrow = false; } } if (doThrow) if ((closeState & CloseExState.Silent) == 0) throw; } }
void ICloseEx.CloseEx(CloseExState closeState) { GlobalLog.Print("FtpDataStream#" + ValidationHelper.HashString(this) + "::CloseEx, state = " + closeState.ToString()); lock (this) { if (m_Closing == true) { return; } m_Closing = true; m_Writeable = false; m_Readable = false; } try { try { if ((closeState & CloseExState.Abort) == 0) { m_NetworkStream.Close(Socket.DefaultCloseTimeout); } else { m_NetworkStream.Close(0); } } finally { m_Request.DataStreamClosed(closeState); } } catch (Exception exception) { bool doThrow = true; WebException webException = exception as WebException; if (webException != null) { FtpWebResponse response = webException.Response as FtpWebResponse; if (response != null) { if (!m_IsFullyRead && response.StatusCode == FtpStatusCode.ConnectionClosed) { doThrow = false; } } } if (doThrow) { if ((closeState & CloseExState.Silent) == 0) { throw; } } } }
void ICloseEx.CloseEx(CloseExState closeState) { if (GlobalLog.IsEnabled) { GlobalLog.Print("FtpDataStream#" + LoggingHash.HashString(this) + "::CloseEx, state = " + closeState.ToString()); } lock (this) { if (_closing == true) { return; } _closing = true; _writeable = false; _readable = false; } try { try { if ((closeState & CloseExState.Abort) == 0) { _networkStream.Close(DefaultCloseTimeout); } else { _networkStream.Close(0); } } finally { _request.DataStreamClosed(closeState); } } catch (Exception exception) { bool doThrow = true; WebException webException = exception as WebException; if (webException != null) { FtpWebResponse response = webException.Response as FtpWebResponse; if (response != null) { if (!_isFullyRead && response.StatusCode == FtpStatusCode.ConnectionClosed) { doThrow = false; } } } if (doThrow) { if ((closeState & CloseExState.Silent) == 0) { throw; } } } }