Added SyncNewObject() to IRegionSyncModule, to be called when new object is

added to local SceneObject (by local operation, not by receiving sync message).
Code seems good for initial sync when one CM connects to PSA.
dsg
Huaiyu (Kitty) Liu 2011-04-15 12:15:28 -07:00
parent 9dfc0e92b8
commit 21c48088d8
3 changed files with 264 additions and 224 deletions

View File

@ -336,6 +336,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
//Legacy SendNewObject and SendDeleteObject for Bucket based sync protocol
/// <summary>
/// Send a sync message to add the given object to other sync nodes.
/// </summary>
@ -541,6 +543,40 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
/////////////////////////////////////////////////////////////
//New IRegionSyncModule functions for per property sync'ing
/////////////////////////////////////////////////////////////
/// <summary>
/// Called when new object is created in local SceneGraph. (Add new object
/// by receiving sync message should not trigger calling this function.)
/// </summary>
/// <param name="sog"></param>
public void SyncNewObject(SceneObjectGroup sog)
{
//First, add PrimSyncInfoManager's record.
foreach (SceneObjectPart part in sog.Parts)
{
m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID);
}
if (!IsSyncingWithOtherSyncNodes())
{
//no SyncConnector connected. No need to send out sync messages.
return;
}
OSDMap encodedSOG = SceneObjectEncoder(sog);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG));
//SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
//SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog);
SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg);
}
public void SyncDeleteObject(SceneObjectGroup sog, bool softDelete)
{
}
#endregion //IRegionSyncModule
@ -762,7 +798,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//if (connector.IsPositionInSyncQuarks(sog.AbsolutePosition))
//{
SymmetricSyncMessage syncMsg = NewObjectMessageEncoder(sog);
//SymmetricSyncMessage syncMsg = NewObjectMessageEncoder(sog);
OSDMap encodedSOG = SceneObjectEncoder(sog);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG));
//SendToSyncConnector(connector, sog, syncMsg);
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
@ -2177,8 +2216,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
{
//string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
//SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
OSDMap data = DeserializeMessage(msg);
//if this is a relay node, forward the event
@ -2196,9 +2233,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
* */
Object sog;
NewObjectMessageDecoder(data, out sog);
SceneObjectGroup group = (SceneObjectGroup)sog;
//NewObjectMessageDecoder(data, out sog);
//SceneObjectGroup group = SceneObjectDecoder(
AddNewSceneObjectByDecoding(data);
}
@ -3879,23 +3917,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!propertyData.ContainsKey("LastUpdateTimeStamp"))
{
m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateTimeStamp");
}else{
}
else
{
m_lastUpdateTimeStamp = propertyData["LastUpdateTimeStamp"].AsLong();
}
if (!propertyData.ContainsKey("LastUpdateSyncID"))
{
m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID");
}else{
m_lastUpdateSyncID = propertyData["LastUpdateSyncID"].AsString();
}
if (!propertyData.ContainsKey("Value"))
{
m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID");
}
else
{
m_lastUpdateSyncID = propertyData["LastUpdateSyncID"].AsString();
}
//We do not test if propertyData.ContainsKey("Value"), since Jason
//serialization seems does not include a value if it's equals to
//the default value. So just let Jason decoding to set the value
//either by reading out of the OSDMap, or set to default value.
switch (m_property)
{
///////////////////////////////////////
@ -4110,7 +4151,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
}
}
public class PropertySerializer
@ -6130,22 +6171,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
data["primUUID"] = OSDMap.FromUUID(primUUID);
//OSDMap propertyData = new OSDMap();
//data["propertyData"] = propertyData;
//If SceneObjectPartProperties.FullUpdate is in updatedProperties,
//convert it to the full list of all properties
HashSet<SceneObjectPartSyncProperties> propertiesToEncoded = updatedProperties;
if (updatedProperties.Contains(SceneObjectPartSyncProperties.FullUpdate))
{
propertiesToEncoded = SceneObjectPart.GetAllPrimProperties();
}
//foreach (SceneObjectPartProperties property in propertiesToEncoded)
//{
//propertyData.Add(property.ToString(), m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded));
//}
OSDMap propertyData = m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded);
data["propertyData"] = propertyData;
@ -6165,7 +6199,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
PrimSyncInfo primSynInfo = new PrimSyncInfo(primUUID, propertyData);
return primSynInfo;
//InsertPrimSyncInfo(primUUID, );
}
/// <summary>

View File

@ -74,10 +74,16 @@ namespace OpenSim.Region.Framework.Interfaces
void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties);
void SyncOutPrimUpdates();
//Legacy calls in Bucket sync'ing
//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);
//New functions for per property sync'ing
void SyncNewObject(SceneObjectGroup sog);
void SyncDeleteObject(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

@ -429,10 +429,11 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
//SYMMETRIC SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
//DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
if (m_parentScene.RegionSyncModule != null)
{
m_parentScene.RegionSyncModule.SendNewObject(sceneObject);
//m_parentScene.RegionSyncModule.SendNewObject(sceneObject);
m_parentScene.RegionSyncModule.SyncNewObject(sceneObject);
}
if (sendClientUpdates)