* Moved OpenMetaverse.StructuredData to a separate library

* Added experimental JSON serialization/deserialization to OSD using LitJSON (works, but subject to change soon)
* Moved packet handling code out of Simian.cs

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2361 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2008-11-18 03:16:38 +00:00
parent 8e84377b22
commit 5fbcd0c4d6
19 changed files with 4080 additions and 28 deletions

View File

@@ -99,6 +99,26 @@ namespace Simian.Extensions
server.UDP.BroadcastPacket(sound, PacketCategory.State);
}
public void Disconnect(Agent agent)
{
// Remove the avatar from the scene
SimulationObject obj;
if (server.Scene.TryGetObject(agent.AgentID, out obj))
server.Scene.ObjectRemove(this, obj);
else
Logger.Log("Disconnecting an agent that is not in the scene", Helpers.LogLevel.Warning);
// Remove the UDP client
server.UDP.RemoveClient(agent);
// HACK: Notify everyone when someone disconnects
OfflineNotificationPacket offline = new OfflineNotificationPacket();
offline.AgentBlock = new OfflineNotificationPacket.AgentBlockBlock[1];
offline.AgentBlock[0] = new OfflineNotificationPacket.AgentBlockBlock();
offline.AgentBlock[0].AgentID = agent.AgentID;
server.UDP.BroadcastPacket(offline, PacketCategory.State);
}
void AgentAnimationHandler(Packet packet, Agent agent)
{
AgentAnimationPacket animPacket = (AgentAnimationPacket)packet;

View File

@@ -84,7 +84,7 @@ namespace Simian.Extensions
server.UDP.SendPacket(agent.AgentID, reply, PacketCategory.Transaction);
server.DisconnectClient(agent);
server.Avatars.Disconnect(agent);
}
}
}

View File

@@ -413,7 +413,7 @@ namespace Simian
Logger.Log(String.Format("Ack timeout for {0}, disconnecting", client.Agent.Avatar.Name),
Helpers.LogLevel.Warning);
server.DisconnectClient(client.Agent);
server.Avatars.Disconnect(client.Agent);
return;
}
}

View File

@@ -9,5 +9,6 @@ namespace Simian
bool AddAnimation(Agent agent, UUID animID);
bool RemoveAnimation(Agent agent, UUID animID);
void SendAnimations(Agent agent);
void Disconnect(Agent agent);
}
}

View File

@@ -10,7 +10,6 @@ using ExtensionLoader;
using ExtensionLoader.Config;
using OpenMetaverse;
using OpenMetaverse.Capabilities;
using OpenMetaverse.Packets;
namespace Simian
{
@@ -85,7 +84,7 @@ namespace Simian
List<FieldInfo> assignables = ExtensionLoader<Simian>.GetInterfaces(this);
ExtensionLoader<Simian>.LoadAllExtensions(Assembly.GetExecutingAssembly(),
AppDomain.CurrentDomain.BaseDirectory, this, extensionList, references,
AppDomain.CurrentDomain.BaseDirectory, extensionList, references,
"Simian.*.dll", "Simian.*.cs", this, assignables);
}
catch (ExtensionException ex)
@@ -131,26 +130,6 @@ namespace Simian
HttpServer.Stop();
}
public void DisconnectClient(Agent agent)
{
// Remove the avatar from the scene
SimulationObject obj;
if (Scene.TryGetObject(agent.AgentID, out obj))
Scene.ObjectRemove(this, obj);
else
Logger.Log("Disconnecting an agent that is not in the scene", Helpers.LogLevel.Warning);
// Remove the UDP client
UDP.RemoveClient(agent);
// HACK: Notify everyone when someone disconnects
OfflineNotificationPacket offline = new OfflineNotificationPacket();
offline.AgentBlock = new OfflineNotificationPacket.AgentBlockBlock[1];
offline.AgentBlock[0] = new OfflineNotificationPacket.AgentBlockBlock();
offline.AgentBlock[0].AgentID = agent.AgentID;
UDP.BroadcastPacket(offline, PacketCategory.State);
}
void InitHttpServer(int port, bool ssl)
{
HttpServer = new HttpServer(port, ssl);