Added sync message type UpdatedPrimProperties, to send prim property updates.
Sender/receiver functions most in place, need more testing.dsg
parent
e84a7157b4
commit
8b08e4b176
|
@ -2153,6 +2153,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SymmetricSyncMessage.MsgType.NewObject:
|
case SymmetricSyncMessage.MsgType.NewObject:
|
||||||
HandleAddNewObject(msg, senderActorID);
|
HandleAddNewObject(msg, senderActorID);
|
||||||
break;
|
break;
|
||||||
|
case SymmetricSyncMessage.MsgType.UpdatedPrimProperties:
|
||||||
|
HandleUpdatedPrimProperties(msg, senderActorID);
|
||||||
|
break;
|
||||||
case SymmetricSyncMessage.MsgType.UpdatedObject:
|
case SymmetricSyncMessage.MsgType.UpdatedObject:
|
||||||
{
|
{
|
||||||
//HandleUpdateObjectBySynchronization(msg, senderActorID);
|
//HandleUpdateObjectBySynchronization(msg, senderActorID);
|
||||||
|
@ -2232,6 +2235,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
// Per property sync handlers
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
|
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2254,11 +2261,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//NewObjectMessageDecoder(data, out sog);
|
//NewObjectMessageDecoder(data, out sog);
|
||||||
|
|
||||||
//SceneObjectGroup group = SceneObjectDecoder(
|
|
||||||
AddNewSceneObjectByDecoding(data);
|
AddNewSceneObjectByDecoding(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleUpdatedPrimProperties(SymmetricSyncMessage msg, string senderActorID)
|
||||||
|
{
|
||||||
|
OSDMap data = DeserializeMessage(msg);
|
||||||
|
UUID primUUID;
|
||||||
|
List<PropertySyncInfo> propertiesSyncInfo;
|
||||||
|
m_primSyncInfoManager.DecodePrimProperties(data, out primUUID, out propertiesSyncInfo);
|
||||||
|
|
||||||
|
SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID);
|
||||||
|
|
||||||
|
if (sop != null && !sop.ParentGroup.IsDeleted && propertiesSyncInfo.Count>0)
|
||||||
|
{
|
||||||
|
m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
// Bucket sync handlers
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler of UpdatedObject message. Note: for a relay node in the
|
/// Handler of UpdatedObject message. Note: for a relay node in the
|
||||||
/// sync topology, it won't forward the message right away. Instead,
|
/// sync topology, it won't forward the message right away. Instead,
|
||||||
|
@ -3168,7 +3193,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_primPropertyUpdates[part.UUID] = propertiesWithSyncInfoUpdated;
|
m_primPropertyUpdates.Add(part.UUID, propertiesWithSyncInfoUpdated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3226,15 +3251,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//Starting a new thread to prepare sync message and enqueue it to SyncConnectors
|
//Starting a new thread to prepare sync message and enqueue it to SyncConnectors
|
||||||
System.Threading.ThreadPool.QueueUserWorkItem(delegate
|
System.Threading.ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
//OSDMap syncData = new OSDMap();
|
|
||||||
//syncData["primCount"] = OSD.FromInteger(primPropertyUpdates.Count);
|
|
||||||
//OSDArray primDataArray = new OSDArray();
|
|
||||||
//syncData["primData"] = (OSD)primDataArray;
|
|
||||||
|
|
||||||
foreach (KeyValuePair<UUID, HashSet<SceneObjectPartSyncProperties>> updatedPrimProperties in primPropertyUpdates)
|
foreach (KeyValuePair<UUID, HashSet<SceneObjectPartSyncProperties>> updatedPrimProperties in primPropertyUpdates)
|
||||||
{
|
{
|
||||||
UUID primUUID = updatedPrimProperties.Key;
|
UUID primUUID = updatedPrimProperties.Key;
|
||||||
HashSet<SceneObjectPartSyncProperties> updatedProperties = updatedPrimProperties.Value;
|
HashSet<SceneObjectPartSyncProperties> updatedProperties = updatedPrimProperties.Value;
|
||||||
|
|
||||||
|
SendPrimPropertyUpdates(primUUID, updatedProperties);
|
||||||
|
/*
|
||||||
OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties);
|
OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties);
|
||||||
|
|
||||||
if (syncData.Count > 0)
|
if (syncData.Count > 0)
|
||||||
|
@ -3242,6 +3265,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData));
|
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData));
|
||||||
SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg);
|
SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg);
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Indicate that the current batch of updates has been completed
|
// Indicate that the current batch of updates has been completed
|
||||||
|
@ -3254,6 +3278,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SendPrimPropertyUpdates(UUID primUUID, HashSet<SceneObjectPartSyncProperties> updatedProperties)
|
||||||
|
{
|
||||||
|
OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties);
|
||||||
|
|
||||||
|
if (syncData.Count > 0)
|
||||||
|
{
|
||||||
|
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData));
|
||||||
|
SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//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(UUID primUUID, SymmetricSyncMessage syncMsg)
|
private void SendPrimUpdateToRelevantSyncConnectors(UUID primUUID, SymmetricSyncMessage syncMsg)
|
||||||
{
|
{
|
||||||
|
@ -3377,7 +3412,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
OSDMap rootData = (OSDMap)data["RootPart"];
|
OSDMap rootData = (OSDMap)data["RootPart"];
|
||||||
//Decode and copy to the list of PrimSyncInfo
|
//Decode and copy to the list of PrimSyncInfo
|
||||||
PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodePrimProperties(rootData);
|
PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodeFullSetPrimProperties(rootData);
|
||||||
SceneObjectPart root = primSyncInfo.PrimSyncInfoToSOP();
|
SceneObjectPart root = primSyncInfo.PrimSyncInfoToSOP();
|
||||||
|
|
||||||
if (root != null)
|
if (root != null)
|
||||||
|
@ -3397,7 +3432,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
OSDArray otherPartsArray = (OSDArray) data["OtherParts"];
|
OSDArray otherPartsArray = (OSDArray) data["OtherParts"];
|
||||||
for(int i=0; i<otherPartsArray.Count; i++){
|
for(int i=0; i<otherPartsArray.Count; i++){
|
||||||
OSDMap partData = (OSDMap)otherPartsArray[i];
|
OSDMap partData = (OSDMap)otherPartsArray[i];
|
||||||
primSyncInfo = m_primSyncInfoManager.DecodePrimProperties(partData);
|
primSyncInfo = m_primSyncInfoManager.DecodeFullSetPrimProperties(partData);
|
||||||
SceneObjectPart part = primSyncInfo.PrimSyncInfoToSOP();
|
SceneObjectPart part = primSyncInfo.PrimSyncInfoToSOP();
|
||||||
if(part!=null){
|
if(part!=null){
|
||||||
sog.AddPart(part);
|
sog.AddPart(part);
|
||||||
|
@ -3605,7 +3640,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//set { m_lastUpdateValue = value; }
|
//set { m_lastUpdateValue = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private string m_lastUpdateValueHash;
|
private string m_lastUpdateValueHash = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Record the time the last sync message about this property is received.
|
/// Record the time the last sync message about this property is received.
|
||||||
|
@ -3647,6 +3682,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_lastUpdateSyncID = syncID;
|
m_lastUpdateSyncID = syncID;
|
||||||
//m_lastSyncUpdateRecvTime == ??
|
//m_lastSyncUpdateRecvTime == ??
|
||||||
|
|
||||||
|
switch (property)
|
||||||
|
{
|
||||||
|
case SceneObjectPartSyncProperties.Shape:
|
||||||
|
case SceneObjectPartSyncProperties.TaskInventory:
|
||||||
|
m_lastUpdateValueHash = GetPropertyHashValue((string)initValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3702,13 +3745,42 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compare the local timestamp with that in pSyncInfo. If the one in
|
||||||
|
/// pSyncInfo is newer, copy its members to the local record.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pSyncInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool CompareAndUpdateSyncInfoBySync(PropertySyncInfo pSyncInfo, long recvTS)
|
||||||
|
{
|
||||||
|
if (pSyncInfo.LastUpdateTimeStamp > m_lastUpdateTimeStamp)
|
||||||
|
{
|
||||||
|
//update
|
||||||
|
UpdateSyncInfoBySync(pSyncInfo.m_lastUpdateTimeStamp, pSyncInfo.m_lastUpdateSyncID, pSyncInfo.m_lastUpdateValue, recvTS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pSyncInfo.LastUpdateTimeStamp == m_lastUpdateTimeStamp)
|
||||||
|
{
|
||||||
|
if (!m_lastUpdateSyncID.Equals(pSyncInfo.LastUpdateSyncID))
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("CompareAndUpdateSyncInfoBySync: property {0} being updated by {1} and {2} at the same time. Do nothing as of current implementation. TO RESOLVE.",
|
||||||
|
m_property, m_lastUpdateSyncID, pSyncInfo.LastUpdateSyncID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update SyncInfo when the property is updated by receiving a sync
|
/// Update SyncInfo when the property is updated by receiving a sync
|
||||||
/// message.
|
/// message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ts"></param>
|
/// <param name="ts"></param>
|
||||||
/// <param name="syncID"></param>
|
/// <param name="syncID"></param>
|
||||||
public void UpdateSyncInfoBySync(long ts, string syncID, long recvTS, Object pValue)
|
public void UpdateSyncInfoBySync(long ts, string syncID, Object pValue, long recvTS)
|
||||||
{
|
{
|
||||||
lock (m_syncInfoLock)
|
lock (m_syncInfoLock)
|
||||||
{
|
{
|
||||||
|
@ -3717,6 +3789,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_lastUpdateSyncID = syncID;
|
m_lastUpdateSyncID = syncID;
|
||||||
m_lastSyncUpdateRecvTime = recvTS;
|
m_lastSyncUpdateRecvTime = recvTS;
|
||||||
m_lastUpdateSource = PropertyUpdateSource.BySync;
|
m_lastUpdateSource = PropertyUpdateSource.BySync;
|
||||||
|
|
||||||
|
switch (m_property)
|
||||||
|
{
|
||||||
|
case SceneObjectPartSyncProperties.Shape:
|
||||||
|
case SceneObjectPartSyncProperties.TaskInventory:
|
||||||
|
m_lastUpdateValueHash = GetPropertyHashValue((string)m_lastUpdateValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3937,6 +4017,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return propertyData;
|
return propertyData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set member values by decoding out of propertyData. Should only
|
||||||
|
/// be called in initialization time (e.g. from constructor).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="propertyData"></param>
|
||||||
private void FromOSDMap(OSDMap propertyData)
|
private void FromOSDMap(OSDMap propertyData)
|
||||||
{
|
{
|
||||||
if (!propertyData.ContainsKey("LastUpdateTimeStamp"))
|
if (!propertyData.ContainsKey("LastUpdateTimeStamp"))
|
||||||
|
@ -3970,6 +4055,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SceneObjectPartSyncProperties.Shape:
|
case SceneObjectPartSyncProperties.Shape:
|
||||||
case SceneObjectPartSyncProperties.TaskInventory:
|
case SceneObjectPartSyncProperties.TaskInventory:
|
||||||
m_lastUpdateValue = (Object)propertyData["Value"].AsString();
|
m_lastUpdateValue = (Object)propertyData["Value"].AsString();
|
||||||
|
m_lastUpdateValueHash = Util.Md5Hash((string)m_lastUpdateValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
|
@ -4177,12 +4263,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetPropertyHashValue(string initValue)
|
||||||
|
{
|
||||||
|
return Util.Md5Hash(initValue);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PropertySerializer
|
public class PropertySerializer
|
||||||
{
|
{
|
||||||
//TO BE TESTED
|
//TO BE TESTED
|
||||||
|
|
||||||
|
|
||||||
public static string SerializeShape(SceneObjectPart part)
|
public static string SerializeShape(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
string serializedShape;
|
string serializedShape;
|
||||||
|
@ -4359,10 +4451,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue);
|
m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS)
|
//public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS)
|
||||||
{
|
//{
|
||||||
m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue);
|
// m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//Triggered when a set of local writes just happened, and ScheduleFullUpdate
|
//Triggered when a set of local writes just happened, and ScheduleFullUpdate
|
||||||
//or ScheduleTerseUpdate has been called.
|
//or ScheduleTerseUpdate has been called.
|
||||||
|
@ -4375,10 +4467,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// <param name="syncID"></param>
|
/// <param name="syncID"></param>
|
||||||
public HashSet<SceneObjectPartSyncProperties> UpdatePropertiesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties, long lastUpdateTS, string syncID)
|
public HashSet<SceneObjectPartSyncProperties> UpdatePropertiesByLocal(SceneObjectPart part, List<SceneObjectPartSyncProperties> updatedProperties, long lastUpdateTS, string syncID)
|
||||||
{
|
{
|
||||||
HashSet<SceneObjectPartSyncProperties> propertiesWithSyncInfoUpdated = new HashSet<SceneObjectPartSyncProperties>();
|
|
||||||
if (part == null) return propertiesWithSyncInfoUpdated;
|
|
||||||
|
|
||||||
HashSet<SceneObjectPartSyncProperties> propertiesToBeSynced = new HashSet<SceneObjectPartSyncProperties>(updatedProperties);
|
HashSet<SceneObjectPartSyncProperties> propertiesToBeSynced = new HashSet<SceneObjectPartSyncProperties>(updatedProperties);
|
||||||
|
if (part == null)
|
||||||
|
{
|
||||||
|
propertiesToBeSynced.Clear();
|
||||||
|
return propertiesToBeSynced;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (SceneObjectPartSyncProperties property in updatedProperties)
|
foreach (SceneObjectPartSyncProperties property in updatedProperties)
|
||||||
{
|
{
|
||||||
|
@ -4389,7 +4483,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
if (part.PhysActor == null)
|
if (part.PhysActor == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits.");
|
m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits.");
|
||||||
return propertiesWithSyncInfoUpdated;
|
return propertiesToBeSynced;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4400,7 +4494,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//Caller indicated many properties have changed. We need to
|
//Caller indicated many properties have changed. We need to
|
||||||
//compare and update all properties
|
//compare and update all properties
|
||||||
propertiesToBeSynced = FullSetPrimProperties;
|
propertiesToBeSynced = FullSetPrimProperties;
|
||||||
return propertiesWithSyncInfoUpdated;
|
break;
|
||||||
|
//return propertiesToBeSynced;
|
||||||
case SceneObjectPartSyncProperties.None:
|
case SceneObjectPartSyncProperties.None:
|
||||||
propertiesToBeSynced.Clear();
|
propertiesToBeSynced.Clear();
|
||||||
break;
|
break;
|
||||||
|
@ -4408,6 +4503,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(propertiesToBeSynced.Count==0){
|
||||||
|
return propertiesToBeSynced;
|
||||||
|
}
|
||||||
|
|
||||||
//Second, for each updated property in the list, compare the value
|
//Second, for each updated property in the list, compare the value
|
||||||
//maintained here and the value in SOP. If different, update the
|
//maintained here and the value in SOP. If different, update the
|
||||||
//value here and set the timestamp and syncID
|
//value here and set the timestamp and syncID
|
||||||
|
@ -4423,20 +4522,50 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SceneObjectPartSyncProperties.Shape:
|
case SceneObjectPartSyncProperties.Shape:
|
||||||
case SceneObjectPartSyncProperties.TaskInventory:
|
case SceneObjectPartSyncProperties.TaskInventory:
|
||||||
//Convert the value of complex properties to string and hash
|
//Convert the value of complex properties to string and hash
|
||||||
updated = CompareAndUpdateHashedValueByLocal(part, property, lastUpdateTS, syncID);
|
updated = CompareHashedValue_UpdateByLocal(part, property, lastUpdateTS, syncID);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
updated = CompareAndUpdateValueByLocal(part, property, lastUpdateTS, syncID);
|
updated = CompareValue_UpdateByLocal(part, property, lastUpdateTS, syncID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
propertiesWithSyncInfoUpdated.Add(property);
|
propertiesToBeSynced.Add(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return propertiesWithSyncInfoUpdated;
|
return propertiesToBeSynced;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: might return status such as Updated, Unchanged, etc to caller
|
||||||
|
public void UpdatePropertiesBySync(SceneObjectPart part, List<PropertySyncInfo> propertiesSyncInfo)
|
||||||
|
{
|
||||||
|
long recvTS = DateTime.Now.Ticks;
|
||||||
|
foreach (PropertySyncInfo pSyncInfo in propertiesSyncInfo)
|
||||||
|
{
|
||||||
|
bool updated = false;
|
||||||
|
SceneObjectPartSyncProperties property = pSyncInfo.Property;
|
||||||
|
//Compare if the value of the property in this SyncModule is
|
||||||
|
//different than the value in SOP
|
||||||
|
if (!m_propertiesSyncInfo.ContainsKey(property))
|
||||||
|
{
|
||||||
|
//Should not happen
|
||||||
|
m_log.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Compare timestamp and update SyncInfo if necessary
|
||||||
|
updated = m_propertiesSyncInfo[property].CompareAndUpdateSyncInfoBySync(pSyncInfo, recvTS);
|
||||||
|
//If updated, update the property value in SOP
|
||||||
|
if (updated)
|
||||||
|
{
|
||||||
|
//UpdateSOPProperty(part, m_propertiesSyncInfo[property]);
|
||||||
|
SetSOPPropertyValue(part, property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4493,7 +4622,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_propertiesSyncInfo[property] = propertySyncInfo;
|
m_propertiesSyncInfo[property] = propertySyncInfo;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap");
|
m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4560,13 +4689,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap");
|
m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Assumption: the caller already locks the access lock, and no need to lock here
|
//Assumption: the caller already locks the access lock, and no need to lock here
|
||||||
private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID)
|
private bool CompareHashedValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID)
|
||||||
{
|
{
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
switch (property)
|
switch (property)
|
||||||
|
@ -4634,7 +4763,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// <param name="syncID"></param>
|
/// <param name="syncID"></param>
|
||||||
/// <returns>Return true if the property's value maintained in this
|
/// <returns>Return true if the property's value maintained in this
|
||||||
/// RegionSyncModule is replaced by SOP's data.</returns>
|
/// RegionSyncModule is replaced by SOP's data.</returns>
|
||||||
private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID)
|
private bool CompareValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID)
|
||||||
{
|
{
|
||||||
bool propertyUpdatedByLocal = false;
|
bool propertyUpdatedByLocal = false;
|
||||||
|
|
||||||
|
@ -5678,6 +5807,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return propertyUpdatedByLocal;
|
return propertyUpdatedByLocal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateSOPProperty(SceneObjectPart sop, PropertySyncInfo propertySyncInfo)
|
||||||
|
{
|
||||||
|
switch (propertySyncInfo.Property)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool ByteArrayEquals(byte[] a, byte[] b)
|
private bool ByteArrayEquals(byte[] a, byte[] b)
|
||||||
{
|
{
|
||||||
if (a.Length != b.Length)
|
if (a.Length != b.Length)
|
||||||
|
@ -6189,6 +6326,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdatePrimSyncInfoBySync(SceneObjectPart part, List<PropertySyncInfo> propertiesSyncInfo)
|
||||||
|
{
|
||||||
|
if (m_primsInSync.ContainsKey(part.UUID))
|
||||||
|
{
|
||||||
|
PrimSyncInfo primSyncInfo = m_primsInSync[part.UUID];
|
||||||
|
primSyncInfo.UpdatePropertiesBySync(part, propertiesSyncInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message
|
||||||
|
m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public OSDMap EncodePrimProperties(UUID primUUID, HashSet<SceneObjectPartSyncProperties> updatedProperties)
|
public OSDMap EncodePrimProperties(UUID primUUID, HashSet<SceneObjectPartSyncProperties> updatedProperties)
|
||||||
{
|
{
|
||||||
OSDMap data = new OSDMap();
|
OSDMap data = new OSDMap();
|
||||||
|
@ -6214,11 +6366,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrimSyncInfo DecodePrimProperties(OSDMap primData)
|
public void DecodePrimProperties(OSDMap primPropertiesData, out UUID primUUID, out List<PropertySyncInfo> propertiesSyncInfo)
|
||||||
|
{
|
||||||
|
primUUID = UUID.Zero;
|
||||||
|
propertiesSyncInfo = new List<PropertySyncInfo>();
|
||||||
|
if (!primPropertiesData.ContainsKey("primUUID") || !primPropertiesData.ContainsKey("propertyData"))
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimSyncInfo DecodeFullSetPrimProperties(OSDMap primData)
|
||||||
{
|
{
|
||||||
if (!primData.ContainsKey("primUUID") || !primData.ContainsKey("propertyData"))
|
if (!primData.ContainsKey("primUUID") || !primData.ContainsKey("propertyData"))
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing");
|
m_log.WarnFormat("DecodeFullSetPrimProperties: either primUUID or propertyData is missing");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
UUID primUUID = primData["primUUID"];
|
UUID primUUID = primData["primUUID"];
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
// SIM <-> CM
|
// SIM <-> CM
|
||||||
Terrain,
|
Terrain,
|
||||||
NewObject, // objects
|
NewObject, // objects
|
||||||
|
UpdatedPrimProperties, //per property sync
|
||||||
UpdatedObject, // objects
|
UpdatedObject, // objects
|
||||||
UpdatedBucketProperties, //object properties in one bucket
|
UpdatedBucketProperties, //object properties in one bucket
|
||||||
RemovedObject, // objects
|
RemovedObject, // objects
|
||||||
|
|
Loading…
Reference in New Issue