Handling RemovedObject as event, instead of as object-update as in the previous approach.

dsg
Huaiyu (Kitty) Liu 2011-01-10 16:30:42 -08:00
parent 5c31e0bdd3
commit f8a0de591d
5 changed files with 50 additions and 45 deletions

View File

@ -935,29 +935,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, OSDParser.SerializeJsonString(data));
}
private void HandleRemovedObject(SymmetricSyncMessage msg)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
if (data == null)
{
SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data.");
return;
}
// Get the parameters from data
//ulong regionHandle = data["regionHandle"].AsULong();
//uint localID = data["UUID"].AsUInteger();
UUID sogUUID = data["UUID"].AsUUID();
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID);
if (sog != null)
{
m_scene.DeleteSceneObjectBySynchronization(sog);
}
}
HashSet<string> exceptions = new HashSet<string>();
private OSDMap DeserializeMessage(SymmetricSyncMessage msg)
@ -990,6 +968,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
private void HandleRemovedObject(SymmetricSyncMessage msg)
{
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
string init_actorID = data["actorID"].AsString();
if (data == null)
{
SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data.");
return;
}
UUID sogUUID = data["UUID"].AsUUID();
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID);
if (sog != null)
{
m_scene.DeleteSceneObjectBySynchronization(sog);
}
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
}
}
/// <summary>
/// The common actions for handling remote events (event initiated at other actors and propogated here)
/// </summary>
@ -1230,8 +1236,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
/// <summary>
/// Send a sync message to remove the given objects in all connected actors, if this is a relay node.
/// UUID is used for identified a removed object.
/// Send a sync message to remove the given objects in all connected actors.
/// UUID is used for identified a removed object. This function now should
/// only be triggered by an object removal that is initiated locally.
/// </summary>
/// <param name="sog"></param>
private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog)
@ -1239,18 +1246,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
//Only send the message out if this is a relay node for sync messages, or this actor caused deleting the object
if (m_isSyncRelay || CheckObjectForSendingUpdate(sog))
{
OSDMap data = new OSDMap(1);
//data["regionHandle"] = OSD.FromULong(regionHandle);
//data["localID"] = OSD.FromUInteger(sog.LocalId);
data["UUID"] = OSD.FromUUID(sog.UUID);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data));
SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
}
//if (m_isSyncRelay || CheckObjectForSendingUpdate(sog))
OSDMap data = new OSDMap(1);
//data["regionHandle"] = OSD.FromULong(regionHandle);
//data["localID"] = OSD.FromUInteger(sog.LocalId);
data["UUID"] = OSD.FromUUID(sog.UUID);
data["actorID"] = OSD.FromString(m_actorID);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data));
SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
}
public void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs)

View File

@ -662,7 +662,8 @@ namespace OpenSim.Region.Framework.Scenes
if (UnlinkSceneObject(group, false))
{
EventManager.TriggerObjectBeingRemovedFromScene(group);
//For object removals caused by remote events (by other actors), do not trigger local event ObjectBeingRemovedFromScene
//EventManager.TriggerObjectBeingRemovedFromScene(group);
EventManager.TriggerParcelPrimCountTainted();
}
@ -2424,12 +2425,13 @@ namespace OpenSim.Region.Framework.Scenes
//SYMMETRIC SYNC
//Set the ActorID and TimeStamp info for this latest update
/*
foreach (SceneObjectPart part in group.Parts)
{
part.SyncInfoUpdate();
}
//end of SYMMETRIC SYNC
* */
}
/// <summary>

View File

@ -478,10 +478,12 @@ namespace OpenSim.Region.Framework.Scenes
{
updates = new List<SceneObjectGroup>(m_updateList.Values);
/*
if (updates.Count > 0)
{
m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for");
}
* */
m_updateList.Clear();

View File

@ -1155,12 +1155,15 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectPart part = parts[i];
//SYMMETRIC SYNC: object remove should be handled through RegionSyncModule
/*
// REGION SYNC
if (Scene.IsSyncedServer())
{
Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part);
//return;
}
* */
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{

View File

@ -5066,14 +5066,6 @@ namespace OpenSim.Region.Framework.Scenes
this.m_lastUpdateActorID = updatedPart.LastUpdateActorID;
this.m_lastUpdateTimeStamp = updatedPart.LastUpdateTimeStamp;
/*
this.m_inventory.Items = (TaskInventoryDictionary)updatedPart.m_inventory.Items.Clone();
//update shape information, for now, only update fileds in Shape whose set functions are defined in PrimitiveBaseShape
this.Shape = updatedPart.Shape.Copy();
this.Shape.TextureEntry = updatedPart.Shape.TextureEntry;
* */
return partUpdateResult;
}
@ -5083,7 +5075,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void ScheduleFullUpdate_SyncInfoUnchanged()
{
m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId);
//m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId);
if (m_parentGroup != null)
{