Fixed more bugs while merging in the functions from commit 5b79e15285.

dsg
Huaiyu (Kitty) Liu 2011-03-31 16:45:12 -07:00
parent 8df517454d
commit 2abffd867f
4 changed files with 66 additions and 59 deletions

View File

@ -458,14 +458,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["softDelete"] = OSD.FromBoolean(softDelete); data["softDelete"] = OSD.FromBoolean(softDelete);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data));
//SendObjectUpdateToRelevantSyncConnectors(sog, rsm); SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm);
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog); //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog);
} }
public void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children) public void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children)
{ {
if(children.Count==0) return; if (children.Count == 0) return;
if (!IsSyncingWithOtherSyncNodes()) if (!IsSyncingWithOtherSyncNodes())
{ {
@ -478,22 +478,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
string sogxml = SceneObjectSerializer.ToXml2Format(linkedGroup); string sogxml = SceneObjectSerializer.ToXml2Format(linkedGroup);
data["linkedGroup"]=OSD.FromString(sogxml); data["linkedGroup"] = OSD.FromString(sogxml);
data["rootID"] = OSD.FromUUID(root.UUID); data["rootID"] = OSD.FromUUID(root.UUID);
data["partCount"] = OSD.FromInteger(children.Count); data["partCount"] = OSD.FromInteger(children.Count);
data["actorID"] = OSD.FromString(m_actorID); data["actorID"] = OSD.FromString(m_actorID);
int partNum = 0; int partNum = 0;
foreach(SceneObjectPart part in children){ foreach (SceneObjectPart part in children)
string partTempID = "part"+partNum; {
string partTempID = "part" + partNum;
data[partTempID] = OSD.FromUUID(part.UUID); data[partTempID] = OSD.FromUUID(part.UUID);
partNum++; partNum++;
m_log.DebugFormat("{0}: SendLinkObject to link {1},{2} with {3}, {4}", part.Name, part.UUID, root.Name, root.UUID); //m_log.DebugFormat("{0}: SendLinkObject to link {1},{2} with {3}, {4}", part.Name, part.UUID, root.Name, root.UUID);
} }
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
//SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm); SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, linkedGroup, rsm);
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, linkedGroup); //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, linkedGroup);
} }
public void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups) public void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups)
@ -924,7 +925,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//string sogxml = SceneObjectSerializer.ToXml2Format(sog); //string sogxml = SceneObjectSerializer.ToXml2Format(sog);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data));
m_log.DebugFormat("{0}: Created a NewObject message for {1},{2}, at pos {3}", LogHeader, sog.Name, sog.UUID, globalPos); //SYNC DEBUG
//m_log.DebugFormat("{0}: Created a NewObject message for {1},{2}, at pos {3}", LogHeader, sog.Name, sog.UUID, globalPos);
return rsm; return rsm;
} }
@ -948,7 +950,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
sog.AbsolutePosition = localPos; sog.AbsolutePosition = localPos;
//TEMP DEBUG //TEMP DEBUG
m_log.DebugFormat("{0}: received NewObject sync message for object {1}, {2} at pos {3}", LogHeader, sog.Name, sog.UUID, sog.AbsolutePosition.ToString()); //m_log.DebugFormat("{0}: received NewObject sync message for object {1}, {2} at pos {3}", LogHeader, sog.Name, sog.UUID, sog.AbsolutePosition.ToString());
Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(sog); Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(sog);
@ -1000,7 +1002,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
lock (m_stats) m_statSOGBucketOut++; lock (m_stats) m_statSOGBucketOut++;
m_log.DebugFormat(LogHeader + " calling SendObjectUpdateToRelevantSyncConnectors for general bucket for sog {0},{1}", sog.Name, sog.UUID); //TEMP SYNC DEBUG
//m_log.DebugFormat(LogHeader + " calling SendObjectUpdateToRelevantSyncConnectors for general bucket for sog {0},{1}", sog.Name, sog.UUID);
SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg); SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg);
@ -1034,7 +1037,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
* */ * */
m_log.DebugFormat("{0}: PrimUpdatesGeneralBucketReceiver called, for update at GroupPosition {1}", LogHeader, groupPosition.ToString()); //TEMP SYNC DEBUG
//m_log.DebugFormat("{0}: PrimUpdatesGeneralBucketReceiver called, for update at GroupPosition {1}", LogHeader, groupPosition.ToString());
Object ret; Object ret;
GeneralBucketPropertiesDecoder(bucketName, data, out ret); GeneralBucketPropertiesDecoder(bucketName, data, out ret);
@ -1057,11 +1061,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
//TEMP SYNC DEBUG
m_log.DebugFormat("{0}: UpdateObjectBySynchronization to be called for: sog {1}, {2}, at post {3}", LogHeader, sog.Name, sog.UUID, sog.AbsolutePosition); //m_log.DebugFormat("{0}: UpdateObjectBySynchronization to be called for: sog {1}, {2}, at post {3}", LogHeader, sog.Name, sog.UUID, sog.AbsolutePosition);
Scene.ObjectUpdateResult updateResult = m_scene.UpdateObjectBySynchronization(sog); Scene.ObjectUpdateResult updateResult = m_scene.UpdateObjectBySynchronization(sog);
/*
switch (updateResult) switch (updateResult)
{ {
case Scene.ObjectUpdateResult.New: case Scene.ObjectUpdateResult.New:
@ -1077,9 +1082,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) unchanged after receiving an update.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString()); //m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) unchanged after receiving an update.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
break; break;
} }
* */
m_log.DebugFormat("{0}: end of processing UpdatedObject {4} bucket, for object {1}, {2}, at pos {3}", LogHeader, sog.Name, //TEMP SYNC DEBUG
sog.UUID, sog.AbsolutePosition, bucketName); // m_log.DebugFormat("{0}: end of processing UpdatedObject {4} bucket, for object {1}, {2}, at pos {3}", LogHeader, sog.Name,
// sog.UUID, sog.AbsolutePosition, bucketName);
} }
} }
@ -1121,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["GroupPosition"] = OSDMap.FromVector3(globalPos); data["GroupPosition"] = OSDMap.FromVector3(globalPos);
//TEMP DEBUG //TEMP DEBUG
m_log.Debug(LogHeader + " GeneralBucketPropertiesEncoder for " + sog.Name + "," + sog.UUID + ". GlobalPos: " + globalPos.ToString()); //m_log.Debug(LogHeader + " GeneralBucketPropertiesEncoder for " + sog.Name + "," + sog.UUID + ". GlobalPos: " + globalPos.ToString());
return data; return data;
} }
@ -1194,9 +1201,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.WarnFormat("{0}: Received a {1} bucket update for object at pos {2}, OUT OF local quarks", LogHeader, bucketName, groupPosition.ToString()); m_log.WarnFormat("{0}: Received a {1} bucket update for object at pos {2}, OUT OF local quarks", LogHeader, bucketName, groupPosition.ToString());
return; return;
} }
* */ * */
m_log.DebugFormat("{0}: PrimUpdatesPhysicsBucketReceiver called, for update at GroupPosition {1}", LogHeader, groupPosition.ToString()); //TEMP SYNC DEBUG
//m_log.DebugFormat("{0}: PrimUpdatesPhysicsBucketReceiver called, for update at GroupPosition {1}", LogHeader, groupPosition.ToString());
Object ret; Object ret;
PhysicsBucketPropertiesDecoder(bucketName, data, out ret); PhysicsBucketPropertiesDecoder(bucketName, data, out ret);
@ -1221,10 +1229,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_scene.UpdateObjectPartBucketProperties(bucketName, partUUID, data, rBucketSyncInfo); m_scene.UpdateObjectPartBucketProperties(bucketName, partUUID, data, rBucketSyncInfo);
//TEMP DEBUG //TEMP SYNC DEBUG
SceneObjectPart localPart = m_scene.GetSceneObjectPart(partUUID); SceneObjectPart localPart = m_scene.GetSceneObjectPart(partUUID);
m_log.DebugFormat("{0}: end of processing UpdatedObject {4} bucket, for part {1}, {2}, at group pos {3}", LogHeader, localPart.Name, //m_log.DebugFormat("{0}: end of processing UpdatedObject {4} bucket, for part {1}, {2}, at group pos {3}", LogHeader, localPart.Name,
localPart.UUID, localPart.GroupPosition, bucketName); // localPart.UUID, localPart.GroupPosition, bucketName);
} }
private OSDMap PhysicsBucketPropertiesEncoder(string bucketName, Object part) private OSDMap PhysicsBucketPropertiesEncoder(string bucketName, Object part)
@ -1454,23 +1462,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
//Object updates are sent by enqueuing into each connector's outQueue.
private void SendObjectUpdateToRelevantSyncConnectors(SceneObjectPart updatedPart, SymmetricSyncMessage syncMsg)
{
HashSet<SyncConnector> syncConnectors = GetSyncConnectorsForObjectUpdates(updatedPart);
foreach (SyncConnector connector in syncConnectors)
{
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
//m_log.Debug("Send " + syncMsg.Type.ToString() + " about sop " + updatedPart.Name + "," + updatedPart.UUID + " at pos "+updatedPart.GroupPosition.ToString()
//+" to " + connector.OtherSideActorID);
connector.EnqueueOutgoingUpdate(updatedPart.UUID, syncMsg.ToBytes());
}
}
//Object updates are sent by enqueuing into each connector's outQueue. //Object updates are sent by enqueuing into each connector's outQueue.
private void SendPrimUpdateToRelevantSyncConnectors(SceneObjectPart updatedPart, SymmetricSyncMessage syncMsg, string lastUpdateActorID) private void SendPrimUpdateToRelevantSyncConnectors(SceneObjectPart updatedPart, SymmetricSyncMessage syncMsg, string lastUpdateActorID)
{ {
@ -2319,6 +2310,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Scene.ObjectUpdateResult updateResult = m_scene.UpdateObjectBySynchronization(sog); Scene.ObjectUpdateResult updateResult = m_scene.UpdateObjectBySynchronization(sog);
/*
switch (updateResult) switch (updateResult)
{ {
case Scene.ObjectUpdateResult.New: case Scene.ObjectUpdateResult.New:
@ -2334,6 +2326,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) unchanged after receiving an update.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString()); //m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) unchanged after receiving an update.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
break; break;
} }
* */
} }
} }
@ -2445,7 +2438,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data = null; data = null;
} }
return data; return data;
} }
private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID) private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID)
{ {
@ -2468,7 +2461,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if this is a relay node, forwards the event //if this is a relay node, forwards the event
if (m_isSyncRelay) if (m_isSyncRelay)
{ {
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, sog); //SendSceneEventToRelevantSyncConnectors(senderActorID, msg, sog);
SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, sog, msg);
} }
@ -2476,12 +2470,12 @@ 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);
m_scene.DeleteSceneObjectBySynchronization(sog); m_scene.DeleteSceneObjectBySynchronization(sog);
} }
else else
{ {
m_log.DebugFormat("{0}: soft delete object {1}", LogHeader, sog.UUID); //m_log.DebugFormat("{0}: soft delete object {1}", LogHeader, sog.UUID);
m_scene.UnlinkSceneObject(sog, true); m_scene.UnlinkSceneObject(sog, true);
} }
} }
@ -2502,7 +2496,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//string init_actorID = data["actorID"].AsString(); //string init_actorID = data["actorID"].AsString();
string sogxml = data["linkedGroup"].AsString(); string sogxml = data["linkedGroup"].AsString();
SceneObjectGroup linkedGroup = SceneObjectSerializer.FromXml2Format(sogxml); //SceneObjectGroup linkedGroup = SceneObjectSerializer.FromXml2Format(sogxml);
SceneObjectGroup linkedGroup = DecodeSceneObjectGroup(sogxml);
UUID rootID = data["rootID"].AsUUID(); UUID rootID = data["rootID"].AsUUID();
int partCount = data["partCount"].AsInteger(); int partCount = data["partCount"].AsInteger();
List<UUID> childrenIDs = new List<UUID>(); List<UUID> childrenIDs = new List<UUID>();
@ -2511,7 +2507,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if this is a relay node, forwards the event //if this is a relay node, forwards the event
if (m_isSyncRelay) if (m_isSyncRelay)
{ {
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, linkedGroup); //SendSceneEventToRelevantSyncConnectors(senderActorID, msg, linkedGroup);
SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, linkedGroup, msg);
} }
for (int i = 0; i < partCount; i++) for (int i = 0; i < partCount; i++)
@ -2520,7 +2517,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
childrenIDs.Add(data[partTempID].AsUUID()); childrenIDs.Add(data[partTempID].AsUUID());
} }
m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID); //TEMP SYNC DEBUG
//m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID);
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs); m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
@ -2529,11 +2527,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleDelinkObject(SymmetricSyncMessage msg, string senderActorID) private void HandleDelinkObject(SymmetricSyncMessage msg, string senderActorID)
{ {
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, null);
}
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
@ -2570,10 +2564,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
string groupTempID = "afterGroup" + i; string groupTempID = "afterGroup" + i;
string sogxml = data[groupTempID].AsString(); string sogxml = data[groupTempID].AsString();
SceneObjectGroup afterGroup = SceneObjectSerializer.FromXml2Format(sogxml); //SceneObjectGroup afterGroup = SceneObjectSerializer.FromXml2Format(sogxml);
SceneObjectGroup afterGroup = DecodeSceneObjectGroup(sogxml);
incomingAfterDelinkGroups.Add(afterGroup); incomingAfterDelinkGroups.Add(afterGroup);
} }
//if this is a relay node, forwards the event
if (m_isSyncRelay)
{
List<SceneObjectGroup> beforeDelinkGroups = new List<SceneObjectGroup>();
foreach (UUID sogID in beforeDelinkGroupIDs)
{
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogID);
beforeDelinkGroups.Add(sog);
}
SendDelinkObjectToRelevantSyncConnectors(senderActorID, beforeDelinkGroups, msg);
}
m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups);
} }

View File

@ -822,7 +822,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
partNames += "(" + child.Name + "," + child.UUID + ")"; partNames += "(" + child.Name + "," + child.UUID + ")";
} }
m_log.Debug("LinkObjectBySync: " + part.Name + "," + part.UUID + " with root "+root.Name+","+root.UUID+"; its SOG has " + part.ParentGroup.Parts.Length + " parts : "+partNames); //m_log.Debug("LinkObjectBySync: " + part.Name + "," + part.UUID + " with root "+root.Name+","+root.UUID+"; its SOG has " + part.ParentGroup.Parts.Length + " parts : "+partNames);
children.Add(part); children.Add(part);
} }

View File

@ -2115,9 +2115,9 @@ namespace OpenSim.Region.Framework.Scenes
// objectGroup.RootPart.SendScheduledUpdates(); // objectGroup.RootPart.SendScheduledUpdates();
//} //}
m_log.DebugFormat( //m_log.DebugFormat(
"[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", // "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); // objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
SceneObjectPart linkPart = objectGroup.m_rootPart; SceneObjectPart linkPart = objectGroup.m_rootPart;

View File

@ -5574,7 +5574,7 @@ namespace OpenSim.Region.Framework.Scenes
localPart.RotationOffset = updatedPart.RotationOffset; localPart.RotationOffset = updatedPart.RotationOffset;
//TEMP DEBUG //TEMP DEBUG
m_log.DebugFormat("SceneObjectPart.PhysicsBucketUpdateProcessor called for part {0},{1}, at GroupPos {2}", localPart.Name, localPart.UUID, localPart.GroupPosition); // m_log.DebugFormat("SceneObjectPart.PhysicsBucketUpdateProcessor called for part {0},{1}, at GroupPos {2}", localPart.Name, localPart.UUID, localPart.GroupPosition);
return; return;
} }
@ -5650,7 +5650,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
//TEMP DEBUG //TEMP DEBUG
m_log.DebugFormat("SceneObjectPart.PhysicsBucketUpdateProcessor called for part {0},{1}, at GroupPos {2}", localPart.Name, localPart.UUID, localPart.GroupPosition); //m_log.DebugFormat("SceneObjectPart.PhysicsBucketUpdateProcessor called for part {0},{1}, at GroupPos {2}", localPart.Name, localPart.UUID, localPart.GroupPosition);
//Schedule updates to be sent out, if the local copy has just been updated //Schedule updates to be sent out, if the local copy has just been updated
//(1) if we are debugging the actor with a viewer attaching to it, //(1) if we are debugging the actor with a viewer attaching to it,