OpenMetaverse.NetworkManager.RequestLogout C# (CSharp) Method

RequestLogout() public method

Initiate the logout process. Check if logout succeeded with the OnLogoutReply event, and if this does not fire the Shutdown() function needs to be manually called
public RequestLogout ( ) : void
return void
        public void RequestLogout()
        {
            // No need to run the disconnect timer any more
            if (DisconnectTimer != null) DisconnectTimer.Dispose();

            // This will catch a Logout when the client is not logged in
            if (CurrentSim == null || !connected)
            {
                Logger.Log("Ignoring RequestLogout(), client is already logged out", Helpers.LogLevel.Warning, Client);
                return;
            }

            Logger.Log("Logging out", Helpers.LogLevel.Info, Client);

            // Send a logout request to the current sim
            LogoutRequestPacket logout = new LogoutRequestPacket();
            logout.AgentData.AgentID = Client.Self.AgentID;
            logout.AgentData.SessionID = Client.Self.SessionID;
            SendPacket(logout);
        }