* First pass at persistence support
* Fixed a chat crashing bug
* Remove avatars from the scene on logout
* Sanity check before adding objects to the scene in ObjectAdd
* Sanity check in CompleteAgentMovementHandler if the avatar is already in the scene
* Added ContainsKey() to DoubleDictionary

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2245 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-09-28 21:28:10 +00:00
parent eb258fbf68
commit a23f41fdca
8 changed files with 218 additions and 36 deletions

View File

@@ -18,7 +18,6 @@ namespace Simian.Extensions
server.UDP.RegisterPacketCallback(PacketType.UseCircuitCode, new PacketCallback(UseCircuitCodeHandler));
server.UDP.RegisterPacketCallback(PacketType.StartPingCheck, new PacketCallback(StartPingCheckHandler));
server.UDP.RegisterPacketCallback(PacketType.LogoutRequest, new PacketCallback(LogoutRequestHandler));
}
public void Stop()
@@ -74,15 +73,6 @@ namespace Simian.Extensions
{
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);
lock (server.Agents)
{
if (server.Agents.ContainsKey(agent.AgentID))
@@ -96,8 +86,25 @@ namespace Simian.Extensions
}
}
// Remove the avatar from the scene
SimulationObject obj;
if (server.Scene.TryGetObject(agent.AgentID, out obj))
server.Scene.ObjectRemove(this, obj);
else
Logger.Log("Logout request from an agent that is not in the scene", Helpers.LogLevel.Warning);
// Remove the UDP client
server.UDP.RemoveClient(agent);
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);
//HACK: Notify everyone when someone logs off
OfflineNotificationPacket offline = new OfflineNotificationPacket();
offline.AgentBlock = new OfflineNotificationPacket.AgentBlockBlock[1];