void ImapSession::Disconnect() { MojLogInfo(m_log, "session %p disconnecting from server", this); if(m_connection.get()) { // Keep a local reference so it doesn't get deleted while in Shutdown // We clear the m_connection reference in ImapSession::ConnectionClosed MojRefCountedPtr<SocketConnection> tempConnection = m_connection; tempConnection->Shutdown(); } else { ConnectionClosed(); } }