OpenMetaverse.NetworkManager.Logout C# (CSharp) Method

Logout() public method

Initiate a blocking logout request. This will return when the logout handshake has completed or when Settings.LOGOUT_TIMEOUT has expired and the network layer is manually shut down
public Logout ( ) : void
return void
        public void Logout()
        {
            AutoResetEvent logoutEvent = new AutoResetEvent(false);
            LogoutCallback callback = 
                delegate(List<UUID> inventoryItems) { logoutEvent.Set(); };
            OnLogoutReply += callback;

            // Send the packet requesting a clean logout
            RequestLogout();

            // Wait for a logout response. If the response is received, shutdown
            // will be fired in the callback. Otherwise we fire it manually with
            // a NetworkTimeout type
            if (!logoutEvent.WaitOne(Client.Settings.LOGOUT_TIMEOUT, false))
                Shutdown(DisconnectType.NetworkTimeout);

            OnLogoutReply -= callback;

            _CurrentSim = null;
        }