internal void Abort()
{
if (!_isClosed)
{
lock (this)
{
if (!_isClosed && _tcpClient != null)
{
//free CBT buffer
if (_channelBindingToken != null)
{
_channelBindingToken.Close();
}
// must destroy manually since sending a QUIT here might not be
// interpreted correctly by the server if it's in the middle of a
// DATA command or some similar situation. This may send a RST
// but this is ok in this situation. Do not reuse this connection
_tcpClient.LingerState = new LingerOption(true, 0);
_networkStream.Close();
_tcpClient.Dispose();
}
_isClosed = true;
}
}
_isConnected = false;
}