Fixed Simian agent object not being removed immediately on logout

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2193 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
2008-08-31 02:03:13 +00:00
parent 698718460b
commit 1fb845c9d4
3 changed files with 16 additions and 5 deletions

View File

@@ -145,7 +145,11 @@ namespace Simian
{
UDPClient client;
if (clients.TryGetValue(agent.AgentID, out client))
{
client.Shutdown();
lock (server.Agents) server.Agents.Remove(agent.AgentID);
return clients.Remove(agent.AgentID, client.Address);
}
else
return false;
}
@@ -372,9 +376,7 @@ namespace Simian
if (Environment.TickCount - client.Agent.TickLastPacketReceived > 10000)
{
Logger.Log(String.Format("Ack timeout for {0}, disconnecting", client.Agent.Avatar.Name), Helpers.LogLevel.Warning);
UUID remove = client.Agent.AgentID;
client.Shutdown();
lock (server.Agents) server.Agents.Remove(remove);
server.UDP.RemoveClient(client.Agent);
//HACK: Notify everyone when someone is disconnected
OfflineNotificationPacket offline = new OfflineNotificationPacket();