Fixed previous commit and added LogoutRequest handler to Simian to remove an agent from the dictionary upon logout.

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2104 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
2008-08-18 07:17:45 +00:00
parent c4cf4a8990
commit 19e26a01d7
2 changed files with 20 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ namespace Simian
{
server.UDPServer.RegisterPacketCallback(PacketType.UseCircuitCode, new UDPServer.PacketCallback(UseCircuitCodeHandler));
server.UDPServer.RegisterPacketCallback(PacketType.StartPingCheck, new UDPServer.PacketCallback(StartPingCheckHandler));
server.UDPServer.RegisterPacketCallback(PacketType.LogoutRequest, new UDPServer.PacketCallback(LogoutRequestHandler));
}
@@ -66,5 +67,22 @@ namespace Simian
agent.SendPacket(complete);
}
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[0];
lock (server.Agents)
{
if (server.Agents.ContainsKey(agent.Address))
server.Agents.Remove(agent.Address);
}
}
}
}