Added SendNewObject to explicitly send out NewObject sync message when new objects are added.

dsg
Huaiyu (Kitty) Liu 2011-03-11 15:39:06 -08:00
parent 48ad2010e5
commit 37dd39fd5d
6 changed files with 57 additions and 17 deletions

View File

@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
if (m_primUpdates[bucketName].Count > 0)
{
m_log.Debug(m_primUpdates[bucketName].Count + " updated parts in bucket " + bucketName);
//m_log.Debug(m_primUpdates[bucketName].Count + " updated parts in bucket " + bucketName);
lock (m_primUpdateLocks[bucketName])
{
updated = true;
@ -376,6 +376,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
/// <summary>
/// Send a sync message to add the given object to other sync nodes.
/// </summary>
/// <param name="sog"></param>
public void SendNewObject(SceneObjectGroup sog)
{
if (!IsSyncingWithOtherActors())
{
//no SyncConnector connected. Do nothing.
return;
}
m_log.DebugFormat(LogHeader + "SendNewObject called for object {0}, {1}", sog.Name, sog.UUID);
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml);
SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
}
/// <summary>
/// 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
@ -772,7 +790,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
m_log.Debug(LogHeader + " Send out Physics Bucket updates for " + updatedPart.Name + ". GroupPosition: " + updatedPart.GroupPosition.ToString());
//m_log.Debug(LogHeader + " Send out Physics Bucket updates for " + updatedPart.Name + ". GroupPosition: " + updatedPart.GroupPosition.ToString());
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
@ -849,8 +867,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
m_log.Debug(LogHeader + " send " + syncMsg.Type.ToString() + " about "+sog.Name+"," + sog.UUID+ " to " + connector.OtherSideActorID);
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
}
}
@ -1459,6 +1475,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return;
}
case SymmetricSyncMessage.MsgType.NewObject:
HandleAddNewObject(msg, senderActorID);
break;
case SymmetricSyncMessage.MsgType.UpdatedObject:
{
HandleAddOrUpdateObjectBySynchronization(msg, senderActorID);
@ -1526,18 +1544,30 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Debug(LogHeader + ": Synchronized terrain");
}
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
{
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
m_log.DebugFormat("{0}: received NewObject sync message from {1}, for object {1}, {2}", LogHeader, senderActorID, sog.Name, sog.UUID);
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
}
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
{
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
//SYNC DEBUG
/*
string partnames = "";
foreach (SceneObjectPart part in sog.Parts)
{
partnames += "(" + part.Name + ", " + part.UUID + ")";
}
m_log.Debug(LogHeader+" received "+msg.Type.ToString()+" from "+senderActorID+" about obj "+sog.Name+", "+sog.UUID+"; parts -- "+partnames);
* */
if (sog.IsDeleted)
{
@ -2039,7 +2069,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// <param name="data">OSDMap data of event args</param>
private void HandleRemoteEvent_OnObjectGrab(string actorID, ulong evSeqNum, OSDMap data)
{
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
// m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID();
@ -2076,7 +2106,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleRemoteEvent_OnObjectGrabbing(string actorID, ulong evSeqNum, OSDMap data)
{
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
// m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID();
UUID primID = data["primID"].AsUUID();
@ -2113,7 +2143,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleRemoteEvent_OnObjectDeGrab(string actorID, ulong evSeqNum, OSDMap data)
{
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
// m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID();
UUID primID = data["primID"].AsUUID();

View File

@ -72,6 +72,7 @@ namespace OpenSim.Region.Framework.Interfaces
//The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector
void SendSceneUpdates();
void SendNewObject(SceneObjectGroup sog);
void SendDeleteObject(SceneObjectGroup sog, bool softDelete);
void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children);
void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups);

View File

@ -544,12 +544,15 @@ namespace OpenSim.Region.Framework.Scenes
///////////////////////////////////////////////////////////////////////////////////////////////
//!!! Obsolete function. Shouldn't be used anymore.
//This function should only be called by an actor who's local Scene is just a cache of the authorative Scene.
//If the object already exists, use the new copy to replace it.
//Return true if added, false if just updated
public bool AddOrUpdateObjectInLocalScene(SceneObjectGroup sog, bool debugWithViewer)
{
return m_sceneGraph.AddOrUpdateObjectInScene(sog, debugWithViewer);
return false;
//return m_sceneGraph.AddOrUpdateObjectInScene(sog, debugWithViewer);
}

View File

@ -383,10 +383,6 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates)
//sceneObject.ScheduleGroupForFullUpdate();
sceneObject.ScheduleGroupForFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.None});
Entities.Add(sceneObject);
if (attachToBackup)
@ -409,6 +405,16 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
//SYMMETRIC SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
if (m_parentScene.RegionSyncModule != null)
{
m_parentScene.RegionSyncModule.SendNewObject(sceneObject);
}
if (sendClientUpdates)
//sceneObject.ScheduleGroupForFullUpdate();
sceneObject.ScheduleGroupForFullUpdate(new List<SceneObjectPartProperties>() { SceneObjectPartProperties.None });
return true;
}
@ -1948,6 +1954,7 @@ namespace OpenSim.Region.Framework.Scenes
//Return false if the entity with the UUID is not a SceneObjectGroup,
//otherwise, return true.
/*
protected internal bool AddOrUpdateObjectInScene(SceneObjectGroup updatedSog, bool debugWithViewer)
{
UUID sogID = updatedSog.UUID;
@ -1989,6 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
* */
#endregion // REGION SYNC

View File

@ -5528,8 +5528,8 @@ namespace OpenSim.Region.Framework.Scenes
//SceneObjectPart localPart = this;
PhysicsActor pa = localPart.PhysActor;
m_log.Debug("Received Physics Bucket updates for " + localPart.Name + ". GroupPosition: " + data["GroupPosition"].AsVector3().ToString()
+ ", Position = " + data["Position"].AsVector3().ToString());
//m_log.Debug("Received Physics Bucket updates for " + localPart.Name + ". GroupPosition: " + data["GroupPosition"].AsVector3().ToString()
// + ", Position = " + data["Position"].AsVector3().ToString());
//m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString());
@ -5779,7 +5779,7 @@ namespace OpenSim.Region.Framework.Scenes
//Second, if need to update local properties, call each bucket's update process
if (m_bucketUpdateProcessors.ContainsKey(bucketName))
{
m_log.Debug("Update properties in " + bucketName + " buckets");
//m_log.Debug("Update properties in " + bucketName + " buckets");
m_bucketUpdateProcessors[bucketName](updatedPart, bucketName);
partUpdateResult = Scene.ObjectUpdateResult.Updated;

View File

@ -3567,14 +3567,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
item = m_host.TaskInventory[invItemID];
}
/*
if ((item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
&& !m_automaticLinkPermission)
{
ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
return;
}
*/
IClientAPI client = null;
ScenePresence sp = World.GetScenePresence(item.PermsGranter);