Added SyncDeleteObject to replace calling to SendDeleteObject.

dsg
Huaiyu (Kitty) Liu 2011-04-15 15:00:02 -07:00
parent 21c48088d8
commit e84a7157b4
2 changed files with 58 additions and 15 deletions

View File

@ -569,13 +569,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap encodedSOG = SceneObjectEncoder(sog); OSDMap encodedSOG = SceneObjectEncoder(sog);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG)); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG));
//SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
//SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog);
SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg); SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg);
} }
public void SyncDeleteObject(SceneObjectGroup sog, bool softDelete) public void SyncDeleteObject(SceneObjectGroup sog, bool softDelete)
{ {
//First, remove from PrimSyncInfoManager's record.
foreach (SceneObjectPart part in sog.Parts)
{
m_primSyncInfoManager.RemovePrimSyncInfo(part);
}
if (!IsSyncingWithOtherSyncNodes())
{
//no SyncConnector connected. Do nothing.
return;
}
OSDMap data = new OSDMap();
data["UUID"] = OSD.FromUUID(sog.UUID);
//TODO: need to put in SyncID instead of ActorID here.
//For now, keep it the same for simple debugging
data["actorID"] = OSD.FromString(m_actorID);
data["softDelete"] = OSD.FromBoolean(softDelete);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data));
SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm);
} }
#endregion //IRegionSyncModule #endregion //IRegionSyncModule
@ -2445,6 +2464,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!softDelete) if (!softDelete)
{ {
//m_log.DebugFormat("{0}: hard delete object {1}", LogHeader, sog.UUID); //m_log.DebugFormat("{0}: hard delete object {1}", LogHeader, sog.UUID);
foreach (SceneObjectPart part in sog.Parts)
{
m_primSyncInfoManager.RemovePrimSyncInfo(part);
}
m_scene.DeleteSceneObjectBySynchronization(sog); m_scene.DeleteSceneObjectBySynchronization(sog);
} }
else else
@ -3123,9 +3146,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// <param name="updatedProperties"></param> /// <param name="updatedProperties"></param>
public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties) public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties)
{ {
m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal called. Simply return for now. More testing later.");
return;
//Sync values with SOP's data and update timestamp according, to //Sync values with SOP's data and update timestamp according, to
//obtain the list of properties that really have been updated //obtain the list of properties that really have been updated
//and should be propogated to other sync nodes. //and should be propogated to other sync nodes.
@ -3386,6 +3406,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
foreach (SceneObjectPart part in sog.Parts)
{
partsPrimSyncInfo[part.UUID].SetGroupProperties(part);
}
//Convert the coordinates if necessary //Convert the coordinates if necessary
/* /*
Vector3 globalPos; Vector3 globalPos;
@ -4501,7 +4526,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SetGroupProperties(SceneObjectPart sop) public void SetGroupProperties(SceneObjectPart sop)
{ {
foreach (SceneObjectPartSyncProperties property in GroupProperties)
{
SetSOPPropertyValue(sop, property);
}
} }
private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID)
@ -6280,6 +6308,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
public bool RemovePrimSyncInfo(SceneObjectPart part)
{
if (!m_primsInSync.ContainsKey(part.UUID))
{
return false;
}
lock (m_primsInSyncLock)
{
Dictionary<UUID, PrimSyncInfo> newPrimsInSync = new Dictionary<UUID, PrimSyncInfo>(m_primsInSync);
newPrimsInSync.Remove(part.UUID);
m_primsInSync = newPrimsInSync;
}
return true;
}
public PrimSyncInfo GetPrimSyncInfo(UUID primUUID) public PrimSyncInfo GetPrimSyncInfo(UUID primUUID)
{ {
if (m_primsInSync.ContainsKey(primUUID)) if (m_primsInSync.ContainsKey(primUUID))

View File

@ -709,9 +709,6 @@ namespace OpenSim.Region.Framework.Scenes
//Similar to DeleteSceneObject, except that this does not change LastUpdateActorID and LastUpdateTimeStamp //Similar to DeleteSceneObject, except that this does not change LastUpdateActorID and LastUpdateTimeStamp
public void DeleteSceneObjectBySynchronization(SceneObjectGroup group) public void DeleteSceneObjectBySynchronization(SceneObjectGroup group)
{ {
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
// Serialise calls to RemoveScriptInstances to avoid // Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup // deadlocking on m_parts inside SceneObjectGroup
@ -2593,16 +2590,18 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerParcelPrimCountTainted(); EventManager.TriggerParcelPrimCountTainted();
} }
group.DeleteGroupFromScene(silent); //DSG SYNC
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
//Propagate the RemovedObject message //Propagate the RemovedObject message
if (RegionSyncModule != null) if (RegionSyncModule != null)
{ {
RegionSyncModule.SendDeleteObject(group, false); //RegionSyncModule.SendDeleteObject(group, false);
RegionSyncModule.SyncDeleteObject(group, false);
} }
//end of SYMMETRIC SYNC //end of DSG SYNC
group.DeleteGroupFromScene(silent);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
} }