void LogoutRequestHandler(Packet packet, Agent agent) { LogoutRequestPacket request = (LogoutRequestPacket)packet; LogoutReplyPacket reply = new LogoutReplyPacket(); reply.AgentData.AgentID = agent.AgentID; reply.AgentData.SessionID = agent.SessionID; reply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; reply.InventoryData[0] = new LogoutReplyPacket.InventoryDataBlock(); reply.InventoryData[0].ItemID = UUID.Zero; server.UDP.SendPacket(agent.AgentID, reply, PacketCategory.Transaction); server.DisconnectClient(agent); }
/// <summary> /// Initiate the logout process. Check if logout succeeded with the /// <code>OnLogoutReply</code> event, and if this does not fire the /// <code>Shutdown()</code> function needs to be manually called /// </summary> 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) { Client.Log("Ignoring RequestLogout(), client is already logged out", Helpers.LogLevel.Warning); return; } Client.Log("Logging out", Helpers.LogLevel.Info); // Send a logout request to the current sim LogoutRequestPacket logout = new LogoutRequestPacket(); logout.AgentData.AgentID = Client.Self.AgentID; logout.AgentData.SessionID = Client.Self.SessionID; CurrentSim.SendPacket(logout, true); }
/// <summary> /// Initiate the logout process. Check if logout succeeded with the /// <code>OnLogoutReply</code> event, and if this does not fire the /// <code>Shutdown()</code> function needs to be manually called /// </summary> public void RequestLogout() { // No need to run the disconnect timer any more DisconnectTimer.Stop(); // This will catch a Logout when the client is not logged in if (CurrentSim == null || !connected) { Client.Log("Ignoring RequestLogout(), client is already logged out", Helpers.LogLevel.Warning); return; } Client.Log("Logging out", Helpers.LogLevel.Info); // Send a logout request to the current sim LogoutRequestPacket logout = new LogoutRequestPacket(); logout.AgentData.AgentID = Client.Self.AgentID; logout.AgentData.SessionID = Client.Self.SessionID; CurrentSim.SendPacket(logout, true); }
/// <summary> /// Initiate the logout process. Check if logout succeeded with the /// <code>OnLogoutReply</code> event, and if this does not fire the /// <code>Shutdown()</code> function needs to be manually called /// </summary> public void RequestLogout() { // No need to run the disconnect timer any more if (DisconnectTimer != null) { DisconnectTimer.Dispose(); DisconnectTimer = null; } // 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); }
/// <summary> /// /// </summary> public void Logout() { // This will catch a Logout when the client is not logged in if (CurrentSim == null || !connected) { return; } Client.Log("Logging out", Helpers.LogLevel.Info); DisconnectTimer.Stop(); connected = false; // Send a logout request to the current sim LogoutRequestPacket logout = new LogoutRequestPacket(); logout.AgentData.AgentID = AgentID; logout.AgentData.SessionID = SessionID; CurrentSim.SendPacket(logout, true); // TODO: We should probably check if the server actually received the logout request // Shutdown the network layer Shutdown(); if (OnDisconnected != null) { OnDisconnected(DisconnectType.ClientInitiated, ""); } }
/// <summary> /// Initiate the logout process (three step process!) /// </summary> public void RequestLogout() { // This will catch a Logout when the client is not logged in if (CurrentSim == null || !connected) { LogoutReplyEvent.Set(); return; } Client.Log("Logging out", Helpers.LogLevel.Info); DisconnectTimer.Stop(); // Send a logout request to the current sim LogoutRequestPacket logout = new LogoutRequestPacket(); logout.AgentData.AgentID = AgentID; logout.AgentData.SessionID = SessionID; CurrentSim.SendPacket(logout, true); LogoutTimer = new System.Timers.Timer(Client.Settings.LOGOUT_TIMEOUT); LogoutTimer.AutoReset = false; LogoutTimer.Elapsed += new ElapsedEventHandler(LogoutTimer_Elapsed); LogoutTimer.Start(); }