public void Disconnect(string reason)
{
lock (sync_)
{
if (null != responder_)
{
this.Log.OnEvent("Session " + this.SessionID + " disconnecting: " + reason);
responder_.Disconnect();
responder_ = null;
}
else
{
this.Log.OnEvent("Session " + this.SessionID + " already disconnected: " + reason);
}
if (state_.ReceivedLogon || state_.SentLogon)
{
state_.ReceivedLogon = false;
state_.SentLogon = false;
this.Application.OnLogout(this.SessionID);
}
state_.SentLogout = false;
state_.ReceivedReset = false;
state_.SentReset = false;
state_.ClearQueue();
state_.LogoutReason = "";
if (this.ResetOnDisconnect)
{
state_.Reset();
}
state_.SetResendRange(0, 0);
}
}