public void InternalClose(ShutdownEventArgs reason)
{
if (!SetCloseReason(reason))
{
if (m_closed)
throw new AlreadyClosedException(m_closeReason);
// We are quiescing, but still allow for server-close
}
OnShutdown();
m_session0.SetSessionClosing(true);
TerminateMainloop();
}