Refreshed from dev, fixed merge problems with packet category logging. (by removing the debug feature)
commit
9704793a1c
|
@ -245,19 +245,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||||
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
|
||||||
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
m_elapsedMSSinceLastStatReport = Environment.TickCount;
|
||||||
System.Timers.Timer packet_type_timer = new System.Timers.Timer(60000);
|
|
||||||
packet_type_timer.Elapsed +=new System.Timers.ElapsedEventHandler(packet_type_timer_Elapsed);
|
|
||||||
packet_type_timer.AutoReset = true;
|
|
||||||
packet_type_timer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void packet_type_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 9; ++i)
|
|
||||||
{
|
|
||||||
int val = Interlocked.Exchange(ref CatCounts[i], 0);
|
|
||||||
m_log.WarnFormat("OutgoingPacket type {0} count = {1}", i, val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void Stop()
|
public new void Stop()
|
||||||
|
|
|
@ -13,6 +13,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
@ -209,11 +210,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
foreach (string bucketName in m_propertyBucketNames)
|
foreach (string bucketName in m_propertyBucketNames)
|
||||||
{
|
{
|
||||||
//if (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName))
|
//if (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName))
|
||||||
if(ToSendoutUpdate(part, bucketName))
|
if(!part.ParentGroup.IsDeleted && HaveUpdatesToSendoutForSync(part, bucketName))
|
||||||
{
|
{
|
||||||
lock (m_primUpdateLocks[bucketName])
|
lock (m_primUpdateLocks[bucketName])
|
||||||
{
|
{
|
||||||
m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID);
|
//m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID+" at pos "+part.GroupPosition.ToString());
|
||||||
m_primUpdates[bucketName][part.UUID] = part;
|
m_primUpdates[bucketName][part.UUID] = part;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,7 +237,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
if (!IsSyncingWithOtherActors())
|
if (!IsSyncingWithOtherActors())
|
||||||
{
|
{
|
||||||
//no SyncConnector connected. Do nothing.
|
//no SyncConnector connected. clear update queues and return.
|
||||||
|
foreach (string bucketName in m_propertyBucketNames)
|
||||||
|
{
|
||||||
|
m_primUpdates[bucketName].Clear();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,14 +261,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
if (m_primUpdates[bucketName].Count > 0)
|
if (m_primUpdates[bucketName].Count > 0)
|
||||||
{
|
{
|
||||||
//m_log.Debug(m_primUpdates[bucketName].Count + " updated parts in bucket " + bucketName);
|
//m_log.DebugFormat(m_primUpdates[bucketName].Count + " to send {0} updated parts in bucket {1}", m_primUpdates[bucketName].Count, bucketName);
|
||||||
|
|
||||||
lock (m_primUpdateLocks[bucketName])
|
lock (m_primUpdateLocks[bucketName])
|
||||||
{
|
{
|
||||||
updated = true;
|
updated = true;
|
||||||
primUpdates.Add(bucketName, new List<SceneObjectPart>(m_primUpdates[bucketName].Values));
|
//primUpdates.Add(bucketName, new List<SceneObjectPart>(m_primUpdates[bucketName].Values));
|
||||||
|
|
||||||
|
//copy the update list
|
||||||
|
List<SceneObjectPart> updateList = new List<SceneObjectPart>();
|
||||||
|
foreach (SceneObjectPart part in m_primUpdates[bucketName].Values)
|
||||||
|
{
|
||||||
|
if (!part.ParentGroup.IsDeleted)
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("include {0},{1} in update list", part.Name, part.UUID);
|
||||||
|
updateList.Add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
primUpdates.Add(bucketName, updateList);
|
||||||
|
|
||||||
m_primUpdates[bucketName].Clear();
|
m_primUpdates[bucketName].Clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,23 +313,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
if (primUpdates.ContainsKey(bucketName) && primUpdates[bucketName].Count > 0)
|
if (primUpdates.ContainsKey(bucketName) && primUpdates[bucketName].Count > 0)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
foreach (SceneObjectGroup sog in primUpdates[bucketName])
|
|
||||||
{
|
|
||||||
|
|
||||||
//If this is a relay node, or at least one part of the object has the last update caused by this actor, then send the update
|
|
||||||
sog.UpdateTaintedBucketSyncInfo(timeStamp);
|
|
||||||
if (m_isSyncRelay || (!sog.IsDeleted && CheckObjectForSendingUpdate(sog)))
|
|
||||||
{
|
|
||||||
//send
|
|
||||||
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
|
||||||
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
|
|
||||||
SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
* */
|
|
||||||
//m_log.Debug(LogHeader + " calling update sender for bucket " + bucketName);
|
//m_log.Debug(LogHeader + " calling update sender for bucket " + bucketName);
|
||||||
m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]);
|
m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]);
|
||||||
|
primUpdates[bucketName].Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (ScenePresence presence in presenceUpdates)
|
foreach (ScenePresence presence in presenceUpdates)
|
||||||
|
@ -397,11 +400,31 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//no SyncConnector connected. Do nothing.
|
//no SyncConnector connected. Do nothing.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_log.DebugFormat(LogHeader + "SendNewObject called for object {0}, {1}", sog.Name, sog.UUID);
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
//m_log.DebugFormat(LogHeader + " SendNewObject called for object {0}, {1}", sog.Name, sog.UUID);
|
||||||
|
|
||||||
|
//This is a new object (newly rezzed). Send out updates for all properties.
|
||||||
|
//For now, a complete list of object properties include properties
|
||||||
|
//in its xml serialization, plus the set of Physics properties as in Physics bucket
|
||||||
|
OSDMap data = new OSDMap();
|
||||||
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml);
|
data["sogxml"] = OSD.FromString(sogxml);
|
||||||
SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
|
OSDArray partArray = new OSDArray();
|
||||||
|
foreach (SceneObjectPart part in sog.Parts){
|
||||||
|
OSDMap partData = PhysicsBucketPropertiesEncoder(m_physicsBucketName, part);
|
||||||
|
partArray.Add(partData);
|
||||||
|
}
|
||||||
|
data["partPhysicsProperties"] = partArray;
|
||||||
|
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
|
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data));
|
||||||
|
|
||||||
|
* */
|
||||||
|
|
||||||
|
SymmetricSyncMessage rsm = CreateNewObjectMessage(sog);
|
||||||
|
|
||||||
|
//SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
|
||||||
|
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -419,7 +442,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(LogHeader+"SendDeleteObject called for object {0}", sog.UUID);
|
//m_log.DebugFormat(LogHeader+"SendDeleteObject called for object {0}", sog.UUID);
|
||||||
|
|
||||||
//Only send the message out if this is a relay node for sync messages, or this actor caused deleting the object
|
//Only send the message out if this is a relay node for sync messages, or this actor caused deleting the object
|
||||||
//if (m_isSyncRelay || CheckObjectForSendingUpdate(sog))
|
//if (m_isSyncRelay || CheckObjectForSendingUpdate(sog))
|
||||||
|
@ -433,7 +456,8 @@ 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);
|
//SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
|
||||||
|
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,13 +485,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
string partTempID = "part"+partNum;
|
string partTempID = "part"+partNum;
|
||||||
data[partTempID] = OSD.FromUUID(part.UUID);
|
data[partTempID] = OSD.FromUUID(part.UUID);
|
||||||
partNum++;
|
partNum++;
|
||||||
|
|
||||||
|
m_log.Debug("SendLinkObject to link " + part.ParentGroup.Name + "," + part.UUID + " with " + root.Name+","+root.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Debug(LogHeader + " to SendLinkObject to link " + children.Count + " parts to " + root.Name);
|
m_log.Debug(LogHeader + " to SendLinkObject to link " + children.Count + " parts to " + root.Name + "," + root.UUID);
|
||||||
m_log.Debug("LinkedObject: "+sogxml);
|
//m_log.Debug("LinkedObject: "+sogxml);
|
||||||
|
|
||||||
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
|
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
|
||||||
SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm);
|
//SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm);
|
||||||
|
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)
|
||||||
|
@ -592,6 +619,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case EventManager.EventNames.Attach:
|
case EventManager.EventNames.Attach:
|
||||||
OnLocalAttach((uint)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2]);
|
OnLocalAttach((uint)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2]);
|
||||||
return;
|
return;
|
||||||
|
case EventManager.EventNames.PhysicsCollision:
|
||||||
|
OnLocalPhysicsCollision((UUID)evArgs[0], (OSDArray)evArgs[1]);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -718,8 +748,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
private delegate void PrimUpdatePerBucketSender(string bucketName, List<SceneObjectPart> primUpdates);
|
private delegate void PrimUpdatePerBucketSender(string bucketName, List<SceneObjectPart> primUpdates);
|
||||||
private Dictionary<string, PrimUpdatePerBucketSender> m_primUpdatesPerBucketSender = new Dictionary<string, PrimUpdatePerBucketSender>();
|
private Dictionary<string, PrimUpdatePerBucketSender> m_primUpdatesPerBucketSender = new Dictionary<string, PrimUpdatePerBucketSender>();
|
||||||
//Timestamps that record the last time each any updates have been sent out for a given bucket
|
|
||||||
private Dictionary<string, long> m_lastUpdateSentTime = new Dictionary<string, long>();
|
/*
|
||||||
|
//The functions that encode properties in each bucket. For now,
|
||||||
|
//general bucket works on SOG, physics bucket works on SOP, so we define
|
||||||
|
//the arg to be of type Object to be general in the interface.
|
||||||
|
//TO DO: redesign the interface once the bucket encoders working on more
|
||||||
|
//consistent/specific arguments.
|
||||||
|
private delegate string UpdatePerBucketEncoder(string bucketName, Object arg);
|
||||||
|
private Dictionary<string, UpdatePerBucketEncoder> m_updatePerBucketEncoder = new Dictionary<string, UpdatePerBucketEncoder>();
|
||||||
|
|
||||||
|
//Decoders of properties in each bucket
|
||||||
|
private delegate void UpdatePerBucketDecoder(string bucketName, string encoding, out Object outData);
|
||||||
|
private Dictionary<string, UpdatePerBucketDecoder> m_updatePerBucketDecoder = new Dictionary<string, UpdatePerBucketDecoder>();
|
||||||
|
* */
|
||||||
|
|
||||||
private object m_updateScenePresenceLock = new object();
|
private object m_updateScenePresenceLock = new object();
|
||||||
private Dictionary<UUID, ScenePresence> m_presenceUpdates = new Dictionary<UUID, ScenePresence>();
|
private Dictionary<UUID, ScenePresence> m_presenceUpdates = new Dictionary<UUID, ScenePresence>();
|
||||||
|
@ -733,6 +775,48 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.Warn("[REGION SYNC MODULE]: StatsTimerElapsed -- NOT yet implemented.");
|
m_log.Warn("[REGION SYNC MODULE]: StatsTimerElapsed -- NOT yet implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SymmetricSyncMessage CreateNewObjectMessage(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
OSDMap data = new OSDMap();
|
||||||
|
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
|
data["sogxml"] = OSD.FromString(sogxml);
|
||||||
|
OSDArray partArray = new OSDArray();
|
||||||
|
foreach (SceneObjectPart part in sog.Parts)
|
||||||
|
{
|
||||||
|
OSDMap partData = PhysicsBucketPropertiesEncoder(m_physicsBucketName, part);
|
||||||
|
partArray.Add(partData);
|
||||||
|
}
|
||||||
|
data["partPhysicsProperties"] = partArray;
|
||||||
|
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
|
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data));
|
||||||
|
|
||||||
|
return rsm;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleGetTerrainRequest(SyncConnector connector)
|
||||||
|
{
|
||||||
|
string msgData = m_scene.Heightmap.SaveToXmlString();
|
||||||
|
long lastUpdateTimeStamp;
|
||||||
|
string lastUpdateActorID;
|
||||||
|
m_scene.RequestModuleInterface<ITerrainModule>().GetSyncInfo(out lastUpdateTimeStamp, out lastUpdateActorID);
|
||||||
|
|
||||||
|
OSDMap data = new OSDMap(3);
|
||||||
|
data["terrain"] = OSD.FromString(msgData);
|
||||||
|
data["actorID"] = OSD.FromString(lastUpdateActorID);
|
||||||
|
data["timeStamp"] = OSD.FromLong(lastUpdateTimeStamp);
|
||||||
|
|
||||||
|
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.Terrain, OSDParser.SerializeJsonString(data));
|
||||||
|
connector.Send(syncMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleGetObjectRequest(SyncConnector connector, SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
SymmetricSyncMessage syncMsg = CreateNewObjectMessage(sog);
|
||||||
|
|
||||||
|
//SendToSyncConnector(connector, sog, syncMsg);
|
||||||
|
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
|
||||||
|
}
|
||||||
|
|
||||||
//Read in configuration for which property-bucket each property belongs to, and the description of each bucket
|
//Read in configuration for which property-bucket each property belongs to, and the description of each bucket
|
||||||
private void PopulatePropertyBucketMap(IConfig config)
|
private void PopulatePropertyBucketMap(IConfig config)
|
||||||
{
|
{
|
||||||
|
@ -747,32 +831,96 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//Going forward, we may serialize the properties differently, e.g. using OSDMap
|
//Going forward, we may serialize the properties differently, e.g. using OSDMap
|
||||||
private void PrimUpdatesGeneralBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
|
private void PrimUpdatesGeneralBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
|
||||||
{
|
{
|
||||||
UpdateBucektLastSentTime(bucketName);
|
|
||||||
|
|
||||||
Dictionary<UUID, SceneObjectGroup> updatedObjects = new Dictionary<UUID, SceneObjectGroup>();
|
Dictionary<UUID, SceneObjectGroup> updatedObjects = new Dictionary<UUID, SceneObjectGroup>();
|
||||||
foreach (SceneObjectPart part in primUpdates)
|
foreach (SceneObjectPart part in primUpdates)
|
||||||
{
|
{
|
||||||
|
if(!part.ParentGroup.IsDeleted)
|
||||||
updatedObjects[part.ParentGroup.UUID] = part.ParentGroup;
|
updatedObjects[part.ParentGroup.UUID] = part.ParentGroup;
|
||||||
}
|
}
|
||||||
|
long timeStamp = DateTime.Now.Ticks;
|
||||||
foreach (SceneObjectGroup sog in updatedObjects.Values)
|
foreach (SceneObjectGroup sog in updatedObjects.Values)
|
||||||
{
|
{
|
||||||
sog.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks); //this update the timestamp and clear the taint info of the bucket
|
sog.UpdateTaintedBucketSyncInfo(bucketName, timeStamp); //this update the timestamp and clear the taint info of the bucket
|
||||||
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
string sogGeneralBucketEncoding = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
|
//string sogGeneralBucketEncoding = GeneralBucketPropertiesEncoder(bucketName, sog, null);
|
||||||
lock (m_stats) m_statSOGBucketOut++;
|
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogGeneralBucketEncoding);
|
||||||
SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg);
|
|
||||||
|
//TEMP DEBUG
|
||||||
|
foreach (SceneObjectPart part in sog.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + "PrimUpdatesGeneralBucketSender: part " + part.Name + "," + part.UUID + ", IsAttachment = true");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (m_stats) m_statSOGBucketOut++;
|
||||||
|
|
||||||
|
//m_log.DebugFormat(LogHeader + " calling SendObjectUpdateToRelevantSyncConnectors for general bucket for sog {0},{1}", sog.Name, sog.UUID);
|
||||||
|
|
||||||
|
SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg);
|
||||||
|
|
||||||
|
//clear the taints
|
||||||
|
foreach (SceneObjectPart part in sog.Parts)
|
||||||
|
{
|
||||||
|
part.BucketSyncInfoList[bucketName].ClearBucketTaintBySync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//UpdateBucektLastSentTime(bucketName, timeStamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GeneralBucketPropertiesEncoder(string bucketName, Object sog)
|
||||||
|
{
|
||||||
|
if (sog is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = (SceneObjectGroup)sog;
|
||||||
|
return SceneObjectSerializer.ToXml2Format(group);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GeneralBucketPropertiesDecoder(string bucketName, string encoding, out Object sog)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = SceneObjectSerializer.FromXml2Format(encoding);
|
||||||
|
sog = (Object)group;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrimUpdatesPhysicsBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
|
private void PrimUpdatesPhysicsBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
|
||||||
{
|
{
|
||||||
UpdateBucektLastSentTime(bucketName);
|
|
||||||
|
|
||||||
foreach (SceneObjectPart updatedPart in primUpdates)
|
foreach (SceneObjectPart updatedPart in primUpdates)
|
||||||
{
|
{
|
||||||
|
if (updatedPart.ParentGroup.IsDeleted)
|
||||||
|
continue;
|
||||||
|
|
||||||
updatedPart.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks);
|
updatedPart.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks);
|
||||||
|
|
||||||
|
//string partPhysicsBucketEncoding = PhysicsBucketPropertiesEncoder(bucketName, updatedPart);
|
||||||
|
OSDMap partData = PhysicsBucketPropertiesEncoder(bucketName, updatedPart);
|
||||||
|
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(partData));
|
||||||
|
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
|
||||||
|
|
||||||
|
//TEMP DEBUG
|
||||||
|
if (updatedPart.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + "PrimUpdatesPhysicsBucketSender: part " + updatedPart.Name + "," + updatedPart.UUID + ", IsAttachment = true");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lock (m_stats) m_statPhysBucketOut++;
|
||||||
|
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
|
||||||
|
|
||||||
|
//clear the taints
|
||||||
|
updatedPart.BucketSyncInfoList[bucketName].ClearBucketTaintBySync();
|
||||||
|
}
|
||||||
|
|
||||||
|
//UpdateBucektLastSentTime(bucketName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OSDMap PhysicsBucketPropertiesEncoder(string bucketName, SceneObjectPart updatedPart)
|
||||||
|
{
|
||||||
OSDMap data = new OSDMap();
|
OSDMap data = new OSDMap();
|
||||||
|
|
||||||
data["UUID"] = OSD.FromUUID(updatedPart.UUID);
|
data["UUID"] = OSD.FromUUID(updatedPart.UUID);
|
||||||
|
@ -803,39 +951,38 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
data["Buoyancy"] = OSD.FromReal(pa.Buoyancy);
|
data["Buoyancy"] = OSD.FromReal(pa.Buoyancy);
|
||||||
data["CollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
|
data["CollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
|
||||||
data["IsColliding"] = OSD.FromBoolean(pa.IsColliding);
|
data["IsColliding"] = OSD.FromBoolean(pa.IsColliding);
|
||||||
|
|
||||||
|
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
|
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
|
||||||
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
|
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 + ","+updatedPart.UUID+ ". GroupPosition: " + updatedPart.GroupPosition.ToString());
|
||||||
|
|
||||||
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
|
return data;
|
||||||
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
|
|
||||||
lock (m_stats) m_statPhysBucketOut++;
|
|
||||||
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PhysicsBucketPropertiesDecoder(string bucketName, SymmetricSyncMessage msg, out Object sog)
|
||||||
|
{
|
||||||
|
OSDMap data = DeserializeMessage(msg);
|
||||||
|
sog = (Object)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBucektLastSentTime(string bucketName)
|
private bool HaveUpdatesToSendoutForSync(SceneObjectPart part, string bucketName)
|
||||||
{
|
{
|
||||||
long timeStamp = DateTime.Now.Ticks;
|
if (m_isSyncRelay)
|
||||||
/*
|
|
||||||
if (m_lastUpdateSentTime.ContainsKey(bucketName))
|
|
||||||
{
|
{
|
||||||
m_lastUpdateSentTime[bucketName] = timeStamp;
|
return (part.HasPropertyUpdatedLocally(bucketName) || part.HasPropertyUpdatedBySync(bucketName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_lastUpdateSentTime.Add(bucketName, timeStamp);
|
return part.HasPropertyUpdatedLocally(bucketName);
|
||||||
}
|
|
||||||
* */
|
|
||||||
m_lastUpdateSentTime[bucketName] = timeStamp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ToSendoutUpdate(SceneObjectPart part, string bucketName)
|
//return (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName));
|
||||||
{
|
|
||||||
|
/*
|
||||||
if (!m_isSyncRelay)
|
if (!m_isSyncRelay)
|
||||||
{
|
{
|
||||||
return part.HasPropertyUpdatedLocallyInGivenBucket(bucketName);
|
return part.HasPropertyUpdatedLocallyInGivenBucket(bucketName);
|
||||||
|
@ -846,24 +993,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
* */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//by default, there are two property buckets: the "General" bucket and the "Physics" bucket.
|
||||||
|
private string m_generalBucketName = "General";
|
||||||
|
private string m_physicsBucketName = "Physics";
|
||||||
//If nothing configured in the config file, this is the default settings for grouping properties into different bucket
|
//If nothing configured in the config file, this is the default settings for grouping properties into different bucket
|
||||||
private void PopulatePropertyBuketMapByDefault()
|
private void PopulatePropertyBuketMapByDefault()
|
||||||
{
|
{
|
||||||
//by default, there are two property buckets: the "General" bucket and the "Physics" bucket.
|
|
||||||
string generalBucketName = "General";
|
m_propertyBucketNames.Add(m_generalBucketName);
|
||||||
string physicsBucketName = "Physics";
|
m_propertyBucketNames.Add(m_physicsBucketName);
|
||||||
m_propertyBucketNames.Add(generalBucketName);
|
|
||||||
m_propertyBucketNames.Add(physicsBucketName);
|
|
||||||
m_maxNumOfPropertyBuckets = m_propertyBucketNames.Count;
|
m_maxNumOfPropertyBuckets = m_propertyBucketNames.Count;
|
||||||
|
|
||||||
//Linking each bucket with the sender function that serializes the properties in the bucket and send out sync message
|
//Linking each bucket with the sender function that serializes the properties in the bucket and send out sync message
|
||||||
m_primUpdatesPerBucketSender.Add("General", PrimUpdatesGeneralBucketSender);
|
m_primUpdatesPerBucketSender.Add(m_generalBucketName, PrimUpdatesGeneralBucketSender);
|
||||||
m_primUpdatesPerBucketSender.Add("Physics", PrimUpdatesPhysicsBucketSender);
|
m_primUpdatesPerBucketSender.Add(m_physicsBucketName, PrimUpdatesPhysicsBucketSender);
|
||||||
|
|
||||||
m_lastUpdateSentTime.Add("General", 0);
|
/*
|
||||||
m_lastUpdateSentTime.Add("Physics", 0);
|
m_updatePerBucketEncoder.Add(generalBucketName, GeneralBucketPropertiesEncoder);
|
||||||
|
m_updatePerBucketEncoder.Add(physicsBucketName, PhysicsBucketPropertiesEncoder);
|
||||||
|
|
||||||
|
m_updatePerBucketDecoder.Add(generalBucketName, GeneralBucketPropertiesDecoder);
|
||||||
|
m_updatePerBucketDecoder.Add(physicsBucketName, PhysicsBucketPropertiesDecoder);
|
||||||
|
* */
|
||||||
|
|
||||||
|
//m_lastUpdateSentTime.Add("General", 0);
|
||||||
|
//m_lastUpdateSentTime.Add("Physics", 0);
|
||||||
|
|
||||||
//Mapping properties to buckets.
|
//Mapping properties to buckets.
|
||||||
foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties)))
|
foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties)))
|
||||||
|
@ -889,11 +1046,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SceneObjectPartProperties.Buoyancy:
|
case SceneObjectPartProperties.Buoyancy:
|
||||||
case SceneObjectPartProperties.IsCollidingGround:
|
case SceneObjectPartProperties.IsCollidingGround:
|
||||||
case SceneObjectPartProperties.IsColliding:
|
case SceneObjectPartProperties.IsColliding:
|
||||||
m_primPropertyBucketMap.Add(property, physicsBucketName);
|
m_primPropertyBucketMap.Add(property, m_physicsBucketName);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//all other properties belong to the "General" bucket.
|
//all other properties belong to the "General" bucket.
|
||||||
m_primPropertyBucketMap.Add(property, generalBucketName);
|
m_primPropertyBucketMap.Add(property, m_generalBucketName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -921,6 +1078,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
|
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
|
||||||
|
|
||||||
|
//m_log.Debug("Send " + syncMsg.Type.ToString() + " about sog "+sog.Name+","+sog.UUID+ " at pos "+sog.AbsolutePosition.ToString()+" to " + connector.OtherSideActorID);
|
||||||
|
|
||||||
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
|
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -934,6 +1093,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
//string sogxml = SceneObjectSerializer.ToXml2Format(sog);
|
||||||
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
|
//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());
|
connector.EnqueueOutgoingUpdate(updatedPart.UUID, syncMsg.ToBytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -959,9 +1122,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//Events are send out right away, without being put into the connector's outQueue first.
|
//Events are send out right away, without being put into the connector's outQueue first.
|
||||||
//May need a better method for managing the outgoing messages (i.e. prioritizing object updates and events)
|
//May need a better method for managing the outgoing messages (i.e. prioritizing object updates and events)
|
||||||
private void SendSceneEventToRelevantSyncConnectors(string init_actorID, SymmetricSyncMessage rsm)
|
private void SendSceneEventToRelevantSyncConnectors(string init_actorID, SymmetricSyncMessage rsm, SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
List<SyncConnector> syncConnectors = GetSyncConnectorsForSceneEvents(init_actorID, rsm);
|
//TODO: need to pick connectors based on sog position (quark it resides in)
|
||||||
|
List<SyncConnector> syncConnectors = GetSyncConnectorsForSceneEvents(init_actorID, rsm, sog);
|
||||||
|
|
||||||
foreach (SyncConnector connector in syncConnectors)
|
foreach (SyncConnector connector in syncConnectors)
|
||||||
{
|
{
|
||||||
|
@ -1015,6 +1179,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//in other parts as well, so we are sending to all connectors.
|
//in other parts as well, so we are sending to all connectors.
|
||||||
ForEachSyncConnector(delegate(SyncConnector connector)
|
ForEachSyncConnector(delegate(SyncConnector connector)
|
||||||
{
|
{
|
||||||
|
//if(!connector.OtherSideActorID.Equals(sog.BucketSyncInfoUpdate[
|
||||||
syncConnectors.Add(connector);
|
syncConnectors.Add(connector);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1206,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sog"></param>
|
/// <param name="sog"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private List<SyncConnector> GetSyncConnectorsForSceneEvents(string init_actorID, SymmetricSyncMessage rsm)
|
private List<SyncConnector> GetSyncConnectorsForSceneEvents(string init_actorID, SymmetricSyncMessage rsm, SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
List<SyncConnector> syncConnectors = new List<SyncConnector>();
|
List<SyncConnector> syncConnectors = new List<SyncConnector>();
|
||||||
if (m_isSyncRelay)
|
if (m_isSyncRelay)
|
||||||
|
@ -1287,6 +1452,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.WarnFormat("SyncStateReport -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount);
|
m_log.WarnFormat("SyncStateReport -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount);
|
||||||
|
foreach (SceneObjectGroup sog in sogList)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_isSyncRelay)
|
||||||
|
{
|
||||||
|
SymmetricSyncMessage msg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.SyncStateReport);
|
||||||
|
ForEachSyncConnector(delegate(SyncConnector connector)
|
||||||
|
{
|
||||||
|
connector.Send(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SyncDebug(Object[] args)
|
private void SyncDebug(Object[] args)
|
||||||
|
@ -1415,7 +1594,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
private void DoInitialSync()
|
private void DoInitialSync()
|
||||||
{
|
{
|
||||||
m_scene.DeleteAllSceneObjects();
|
//m_scene.DeleteAllSceneObjects();
|
||||||
|
m_scene.DeleteAllSceneObjectsBySync();
|
||||||
|
|
||||||
SendSyncMessage(SymmetricSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName);
|
SendSyncMessage(SymmetricSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName);
|
||||||
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
||||||
|
@ -1494,7 +1674,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg"></param>
|
/// <param name="msg"></param>
|
||||||
/// <param name="senderActorID">ActorID of the sender</param>
|
/// <param name="senderActorID">ActorID of the sender</param>
|
||||||
public void HandleIncomingMessage(SymmetricSyncMessage msg, string senderActorID)
|
public void HandleIncomingMessage(SymmetricSyncMessage msg, string senderActorID, SyncConnector syncConnector)
|
||||||
{
|
{
|
||||||
lock (m_stats) m_statMsgsIn++;
|
lock (m_stats) m_statMsgsIn++;
|
||||||
//Added senderActorID, so that we don't have to include actorID in sync messages -- TODO
|
//Added senderActorID, so that we don't have to include actorID in sync messages -- TODO
|
||||||
|
@ -1503,7 +1683,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SymmetricSyncMessage.MsgType.GetTerrain:
|
case SymmetricSyncMessage.MsgType.GetTerrain:
|
||||||
{
|
{
|
||||||
//SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, m_scene.Heightmap.SaveToXmlString());
|
//SendSyncMessage(SymmetricSyncMessage.MsgType.Terrain, m_scene.Heightmap.SaveToXmlString());
|
||||||
SendTerrainUpdateMessage();
|
//SendTerrainUpdateMessage();
|
||||||
|
HandleGetTerrainRequest(syncConnector);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SymmetricSyncMessage.MsgType.Terrain:
|
case SymmetricSyncMessage.MsgType.Terrain:
|
||||||
|
@ -1524,10 +1705,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
if (e is SceneObjectGroup)
|
if (e is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
string sogxml = SceneObjectSerializer.ToXml2Format((SceneObjectGroup)e);
|
//string sogxml = SceneObjectSerializer.ToXml2Format((SceneObjectGroup)e);
|
||||||
SendSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml);
|
//SendSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml);
|
||||||
|
SceneObjectGroup sog = (SceneObjectGroup)e;
|
||||||
//m_log.Debug(LogHeader + ": " + sogxml);
|
HandleGetObjectRequest(syncConnector, sog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1537,8 +1718,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
break;
|
break;
|
||||||
case SymmetricSyncMessage.MsgType.UpdatedObject:
|
case SymmetricSyncMessage.MsgType.UpdatedObject:
|
||||||
{
|
{
|
||||||
HandleAddOrUpdateObjectBySynchronization(msg, senderActorID);
|
//HandleAddOrUpdateObjectBySynchronization(msg, senderActorID);
|
||||||
//HandleAddNewObject(sog);
|
HandleUpdateObjectBySynchronization(msg, senderActorID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SymmetricSyncMessage.MsgType.UpdatedBucketProperties:
|
case SymmetricSyncMessage.MsgType.UpdatedBucketProperties:
|
||||||
|
@ -1572,10 +1753,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SymmetricSyncMessage.MsgType.ObjectGrabbing:
|
case SymmetricSyncMessage.MsgType.ObjectGrabbing:
|
||||||
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
|
case SymmetricSyncMessage.MsgType.ObjectDeGrab:
|
||||||
case SymmetricSyncMessage.MsgType.Attach:
|
case SymmetricSyncMessage.MsgType.Attach:
|
||||||
|
case SymmetricSyncMessage.MsgType.PhysicsCollision:
|
||||||
{
|
{
|
||||||
HandleRemoteEvent(msg, senderActorID);
|
HandleRemoteEvent(msg, senderActorID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
case SymmetricSyncMessage.MsgType.SyncStateReport:
|
||||||
|
{
|
||||||
|
SyncStateReport(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1603,13 +1790,90 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
|
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);
|
||||||
|
|
||||||
|
//First, create the object group and add it to Scene
|
||||||
|
string sogxml = data["sogxml"];
|
||||||
|
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
|
||||||
|
//Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
|
||||||
|
|
||||||
|
//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.AddNewSceneObjectBySync(sog);
|
||||||
|
|
||||||
|
//if this is a relay node, forward the event
|
||||||
|
if (m_isSyncRelay)
|
||||||
|
{
|
||||||
|
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, sog);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Second, update the physics properties of each prim in the object
|
||||||
|
OSDArray partArray = (OSDArray)data["partPhysicsProperties"];
|
||||||
|
for (int i = 0; i < partArray.Count; i++)
|
||||||
|
{
|
||||||
|
OSDMap partData = (OSDMap)partArray[i];
|
||||||
|
UUID partUUID = partData["UUID"].AsUUID();
|
||||||
|
|
||||||
|
string bucketName = partData["Bucket"].AsString();
|
||||||
|
|
||||||
|
//m_log.DebugFormat("{0}: HandleUpdatedBucketProperties from {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName);
|
||||||
|
|
||||||
|
BucketSyncInfo rBucketSyncInfo = new BucketSyncInfo(bucketName);
|
||||||
|
rBucketSyncInfo.LastUpdateTimeStamp = partData["LastUpdateTimeStamp"].AsLong();
|
||||||
|
rBucketSyncInfo.LastUpdateActorID = partData["LastUpdateActorID"].AsString();
|
||||||
|
// updatedPart.BucketSyncInfoList.Add(bucketName, rBucketSyncInfo);
|
||||||
|
|
||||||
|
m_scene.UpdateObjectPartBucketProperties(bucketName, partUUID, data, rBucketSyncInfo);
|
||||||
|
}
|
||||||
|
//m_log.DebugFormat("{0}: after processing NewObject sync message from {1}, for object {1}, {2}", LogHeader, senderActorID, sog.Name, sog.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
|
||||||
{
|
{
|
||||||
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
|
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
|
||||||
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
|
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
|
||||||
|
lock (m_stats) m_statSOGBucketIn++;
|
||||||
|
|
||||||
m_log.DebugFormat("{0}: received NewObject sync message from {1}, for object {1}, {2}", LogHeader, senderActorID, sog.Name, sog.UUID);
|
if (sog.IsDeleted)
|
||||||
|
{
|
||||||
|
SymmetricSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted object, UUID: {0}.", sog.UUID));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (SceneObjectPart part in sog.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + "HandleUpdateObjectBySynchronization: part " + part.Name + "," + part.UUID + ", IsAttachment = true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//m_log.Debug(LogHeader + "HandleUpdateObjectBySynchronization: sog " + sog.Name + "," + sog.UUID);
|
||||||
|
|
||||||
|
Scene.ObjectUpdateResult updateResult = m_scene.UpdateObjectBySynchronization(sog);
|
||||||
|
|
||||||
|
switch (updateResult)
|
||||||
|
{
|
||||||
|
case Scene.ObjectUpdateResult.New:
|
||||||
|
m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) added.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
|
||||||
|
break;
|
||||||
|
case Scene.ObjectUpdateResult.Updated:
|
||||||
|
m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) updated.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
|
||||||
|
break;
|
||||||
|
case Scene.ObjectUpdateResult.Error:
|
||||||
|
m_log.WarnFormat("[{0} Object \"{1}\" ({1}) ({2}) -- add or update ERROR.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
|
||||||
|
break;
|
||||||
|
case Scene.ObjectUpdateResult.Unchanged:
|
||||||
|
//m_log.DebugFormat("[{0} Object \"{1}\" ({1}) ({2}) unchanged after receiving an update.", LogHeader, sog.Name, sog.UUID.ToString(), sog.LocalId.ToString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
|
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
|
||||||
|
@ -1625,7 +1889,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
partnames += "(" + part.Name + ", " + part.UUID + ")";
|
partnames += "(" + part.Name + ", " + part.UUID + ")";
|
||||||
}
|
}
|
||||||
m_log.Debug(LogHeader+" received "+msg.Type.ToString()+" from "+senderActorID+" about obj "+sog.Name+", "+sog.UUID+"; parts -- "+partnames);
|
|
||||||
|
m_log.Debug(LogHeader+" received "+msg.Type.ToString()+" from "+senderActorID+" about obj "+sog.Name+", "+sog.UUID);//+"; parts -- "+partnames);
|
||||||
* */
|
* */
|
||||||
|
|
||||||
if (sog.IsDeleted)
|
if (sog.IsDeleted)
|
||||||
|
@ -1635,6 +1900,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
foreach (SceneObjectPart part in sog.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + "HandleAddOrUpdateObjectBySynchronization: part " + part.Name + "," + part.UUID + ", IsAttachment = true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
|
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
|
||||||
|
|
||||||
//if (added)
|
//if (added)
|
||||||
|
@ -1672,41 +1945,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
UUID partUUID = data["UUID"].AsUUID();
|
UUID partUUID = data["UUID"].AsUUID();
|
||||||
string bucketName = data["Bucket"].AsString();
|
string bucketName = data["Bucket"].AsString();
|
||||||
|
|
||||||
//m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName);
|
//m_log.DebugFormat("{0}: HandleUpdatedBucketProperties from {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName);
|
||||||
|
|
||||||
/* Commented out since OSDMap is now passed all the way through to the unpacker.
|
|
||||||
* Previous implementation is to create a SOP and copy the values into same and copy them out later.
|
|
||||||
SceneObjectPart updatedPart = new SceneObjectPart();
|
|
||||||
updatedPart.GroupPosition = data["GroupPosition"].AsVector3();
|
|
||||||
updatedPart.OffsetPosition = data["OffsetPosition"].AsVector3();
|
|
||||||
updatedPart.RotationOffset = data["RotationOffset"].AsQuaternion();
|
|
||||||
updatedPart.Velocity = data["Velocity"].AsVector3();
|
|
||||||
updatedPart.AngularVelocity = data["AngularVelocity"].AsVector3();
|
|
||||||
//Scale is a bit complex, we need to have Shape first -- not a good solution, but leave it as is so that we can move on,
|
|
||||||
updatedPart.Shape = new PrimitiveBaseShape();
|
|
||||||
updatedPart.Scale = data["Scale"].AsVector3();
|
|
||||||
|
|
||||||
Dictionary<string, Object> updatedProperties = new Dictionary<string, Object>();
|
|
||||||
updatedProperties.Add("GroupPosition", (Object)data["GroupPosition"].AsVector3());
|
|
||||||
updatedProperties.Add("OffsetPosition", (Object)data["OffsetPosition"].AsVector3());
|
|
||||||
updatedProperties.Add("RotationOffset", (Object)data["RotationOffset"].AsQuaternion());
|
|
||||||
updatedProperties.Add("Velocity", (Object)data["Velocity"].AsVector3());
|
|
||||||
updatedProperties.Add("AngularVelocity", (Object)data["AngularVelocity"].AsVector3());
|
|
||||||
updatedProperties.Add("Scale", (Object)data["Scale"].AsVector3());
|
|
||||||
*/
|
|
||||||
//Other properties to be included
|
|
||||||
/*
|
|
||||||
"Position":
|
|
||||||
"Size":
|
|
||||||
"Force":
|
|
||||||
"RotationalVelocity":
|
|
||||||
"PA_Acceleration":
|
|
||||||
"Torque":
|
|
||||||
"Orientation":
|
|
||||||
"IsPhysical":
|
|
||||||
"Flying":
|
|
||||||
"Buoyancy":
|
|
||||||
* */
|
|
||||||
|
|
||||||
BucketSyncInfo rBucketSyncInfo = new BucketSyncInfo(bucketName);
|
BucketSyncInfo rBucketSyncInfo = new BucketSyncInfo(bucketName);
|
||||||
rBucketSyncInfo.LastUpdateTimeStamp = data["LastUpdateTimeStamp"].AsLong();
|
rBucketSyncInfo.LastUpdateTimeStamp = data["LastUpdateTimeStamp"].AsLong();
|
||||||
|
@ -1784,6 +2023,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID);
|
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID);
|
||||||
|
|
||||||
|
//if this is a relay node, forwards the event
|
||||||
|
if (m_isSyncRelay)
|
||||||
|
{
|
||||||
|
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, sog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sog != null)
|
if (sog != null)
|
||||||
{
|
{
|
||||||
if (!softDelete)
|
if (!softDelete)
|
||||||
|
@ -1798,12 +2044,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if this is a relay node, forwards the event
|
|
||||||
if (m_isSyncRelay)
|
|
||||||
{
|
|
||||||
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
|
|
||||||
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
|
private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
|
||||||
|
@ -1824,6 +2065,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
int partCount = data["partCount"].AsInteger();
|
int partCount = data["partCount"].AsInteger();
|
||||||
List<UUID> childrenIDs = new List<UUID>();
|
List<UUID> childrenIDs = new List<UUID>();
|
||||||
|
|
||||||
|
|
||||||
|
//if this is a relay node, forwards the event
|
||||||
|
if (m_isSyncRelay)
|
||||||
|
{
|
||||||
|
SendSceneEventToRelevantSyncConnectors(senderActorID, msg, linkedGroup);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < partCount; i++)
|
for (int i = 0; i < partCount; i++)
|
||||||
{
|
{
|
||||||
string partTempID = "part" + i;
|
string partTempID = "part" + i;
|
||||||
|
@ -1833,18 +2081,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
m_log.Debug(LogHeader + " received LinkObject from " + senderActorID);
|
m_log.Debug(LogHeader + " received LinkObject from " + senderActorID);
|
||||||
//m_log.Debug("LinkedObject: " + sogxml);
|
//m_log.Debug("LinkedObject: " + sogxml);
|
||||||
|
|
||||||
|
//TEMP DEBUG
|
||||||
|
foreach (SceneObjectPart part in linkedGroup.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug(LogHeader + "HandleLinkObject: part " + part.Name + "," + part.UUID + " IsAttachment = true in incoming sync message");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
|
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
|
||||||
|
|
||||||
//if this is a relay node, forwards the event
|
|
||||||
if (m_isSyncRelay)
|
|
||||||
{
|
|
||||||
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
|
|
||||||
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -1886,12 +2144,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups);
|
m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups);
|
||||||
|
|
||||||
//if this is a relay node, forwards the event
|
|
||||||
if (m_isSyncRelay)
|
|
||||||
{
|
|
||||||
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
|
|
||||||
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1900,6 +2152,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// <param name="msg"></param>
|
/// <param name="msg"></param>
|
||||||
private void HandleRemoteEvent(SymmetricSyncMessage msg, string senderActorID)
|
private void HandleRemoteEvent(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)
|
||||||
{
|
{
|
||||||
|
@ -1944,14 +2203,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
case SymmetricSyncMessage.MsgType.Attach:
|
case SymmetricSyncMessage.MsgType.Attach:
|
||||||
HandleRemoteEvent_OnAttach(init_actorID, evSeqNum, data);
|
HandleRemoteEvent_OnAttach(init_actorID, evSeqNum, data);
|
||||||
break;
|
break;
|
||||||
|
case SymmetricSyncMessage.MsgType.PhysicsCollision:
|
||||||
|
HandleRemoteEvent_PhysicsCollision(init_actorID, evSeqNum, data);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if this is a relay node, forwards the event
|
|
||||||
if (m_isSyncRelay)
|
|
||||||
{
|
|
||||||
//SendSceneEventToRelevantSyncConnectors(init_actorID, msg);
|
|
||||||
SendSceneEventToRelevantSyncConnectors(senderActorID, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2256,7 +2512,33 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
uint localID = part.LocalId;
|
uint localID = part.LocalId;
|
||||||
m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID);
|
m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleRemoteEvent_PhysicsCollision(string actorID, ulong evSeqNum, OSDMap data)
|
||||||
|
{
|
||||||
|
UUID primUUID = data["primUUID"].AsUUID();
|
||||||
|
OSDArray collisionLocalIDs = (OSDArray)data["collisionLocalIDs"];
|
||||||
|
|
||||||
|
SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID);
|
||||||
|
if (part == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no part with UUID {1} found", LogHeader, primUUID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (collisionLocalIDs == null)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no collisionLocalIDs", LogHeader);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build up the collision list. The contact point is ignored so we generate some default.
|
||||||
|
CollisionEventUpdate e = new CollisionEventUpdate();
|
||||||
|
foreach (uint collisionID in collisionLocalIDs)
|
||||||
|
{
|
||||||
|
// e.addCollider(collisionID, new ContactPoint());
|
||||||
|
e.addCollider(collisionID, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
|
||||||
|
}
|
||||||
|
part.PhysicsCollisionLocally(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2304,14 +2586,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
data["running"] = OSD.FromBoolean(isScriptRunning);
|
data["running"] = OSD.FromBoolean(isScriptRunning);
|
||||||
data["assetID"] = OSD.FromUUID(newAssetID);
|
data["assetID"] = OSD.FromUUID(newAssetID);
|
||||||
|
|
||||||
/*
|
|
||||||
data["actorID"] = OSD.FromString(m_actorID);
|
|
||||||
data["seqNum"] = OSD.FromULong(GetNextEventSeq());
|
|
||||||
|
|
||||||
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdateScript, OSDParser.SerializeJsonString(data));
|
|
||||||
//send to actors who are interested in the event
|
|
||||||
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm);
|
|
||||||
* */
|
|
||||||
SendSceneEvent(SymmetricSyncMessage.MsgType.UpdateScript, data);
|
SendSceneEvent(SymmetricSyncMessage.MsgType.UpdateScript, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2415,6 +2689,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
|
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionLocalIDs)
|
||||||
|
{
|
||||||
|
OSDMap data = new OSDMap();
|
||||||
|
data["primUUID"] = OSD.FromUUID(partUUID);
|
||||||
|
data["collisionLocalIDs"] = collisionLocalIDs;
|
||||||
|
SendSceneEvent(SymmetricSyncMessage.MsgType.PhysicsCollision, data);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -2536,20 +2818,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//send to actors who are interested in the event
|
//send to actors who are interested in the event
|
||||||
lock (m_stats) m_statEventOut++;
|
lock (m_stats) m_statEventOut++;
|
||||||
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm);
|
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private void PublishSceneEvent(OSDMap data)
|
|
||||||
{
|
|
||||||
data["actorID"] = OSD.FromString(m_actorID);
|
|
||||||
data["seqNum"] = OSD.FromULong(GetNextEventSeq());
|
|
||||||
|
|
||||||
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.OnUpdateScript, OSDParser.SerializeJsonString(data));
|
|
||||||
SendSceneEventToRelevantSyncConnectors(m_actorID, rsm);
|
|
||||||
}
|
|
||||||
* */
|
|
||||||
|
|
||||||
private ulong GetNextEventSeq()
|
private ulong GetNextEventSeq()
|
||||||
{
|
{
|
||||||
return m_eventSeq++;
|
return m_eventSeq++;
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
|
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
|
||||||
|
|
||||||
//Register for Scene/SceneGraph events
|
//Register for Scene/SceneGraph events
|
||||||
//m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScenePersistence_OnObjectCreate);
|
m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScenePersistence_OnObjectCreate);
|
||||||
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScenePersistence_OnObjectCreateBySync);
|
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScenePersistence_OnObjectCreateBySync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,16 +164,33 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ScenePersistence's actions upon an object is added to the local scene.
|
/// ScenePersistence's actions upon an object is added to the local scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ScenePersistence_OnObjectCreateBySync(EntityBase entity)
|
private void ScenePersistence_OnObjectCreate(EntityBase entity)
|
||||||
{
|
{
|
||||||
if (entity is SceneObjectGroup)
|
if (entity is SceneObjectGroup)
|
||||||
{
|
{
|
||||||
m_log.Warn(LogHeader + ": link to backup for " + entity.UUID);
|
//m_log.Warn(LogHeader + ":OnObjectCreate -- link to backup for " + entity.UUID);
|
||||||
SceneObjectGroup sog = (SceneObjectGroup)entity;
|
SceneObjectGroup sog = (SceneObjectGroup)entity;
|
||||||
|
|
||||||
//probably what we should do here is to set some variable sog.SyncToBackup to true, and sog.ProcessBackup will only run if that value is true,
|
//probably what we should do here is to set some variable sog.SyncToBackup to true, and sog.ProcessBackup will only run if that value is true,
|
||||||
//then we do not need to worry about where an object is attach-to-backup and modify all those lines.
|
//then we do not need to worry about where an object is attach-to-backup and modify all those lines.
|
||||||
|
sog.ToPersistObjectState = true;
|
||||||
|
sog.AttachToBackup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ScenePersistence's actions upon an object is added to the local scene.
|
||||||
|
/// </summary>
|
||||||
|
private void ScenePersistence_OnObjectCreateBySync(EntityBase entity)
|
||||||
|
{
|
||||||
|
if (entity is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
//m_log.Warn(LogHeader + ":OnObjectCreateBySync -- link to backup for " + entity.UUID);
|
||||||
|
SceneObjectGroup sog = (SceneObjectGroup)entity;
|
||||||
|
|
||||||
|
//probably what we should do here is to set some variable sog.SyncToBackup to true, and sog.ProcessBackup will only run if that value is true,
|
||||||
|
//then we do not need to worry about where an object is attach-to-backup and modify all those lines.
|
||||||
|
sog.ToPersistObjectState = true;
|
||||||
sog.AttachToBackup();
|
sog.AttachToBackup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
ObjectGrabbing,
|
ObjectGrabbing,
|
||||||
ObjectDeGrab,
|
ObjectDeGrab,
|
||||||
Attach,
|
Attach,
|
||||||
|
PhysicsCollision,
|
||||||
|
//contorl command
|
||||||
|
SyncStateReport,
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
|
|
||||||
//For any other messages, we simply deliver the message to RegionSyncModule for now.
|
//For any other messages, we simply deliver the message to RegionSyncModule for now.
|
||||||
//Later on, we may deliver messages to different modules, say sync message to RegionSyncModule and event message to ActorSyncModule.
|
//Later on, we may deliver messages to different modules, say sync message to RegionSyncModule and event message to ActorSyncModule.
|
||||||
m_regionSyncModule.HandleIncomingMessage(msg, m_syncOtherSideActorID);
|
m_regionSyncModule.HandleIncomingMessage(msg, m_syncOtherSideActorID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string StatisticIdentifier()
|
public string StatisticIdentifier()
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ObjectGrabbing,
|
ObjectGrabbing,
|
||||||
ObjectDeGrab,
|
ObjectDeGrab,
|
||||||
Attach, //attaching object to avatar
|
Attach, //attaching object to avatar
|
||||||
|
PhysicsCollision,
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventManager(Scene scene)
|
public EventManager(Scene scene)
|
||||||
|
|
|
@ -2203,6 +2203,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
partnames += "(" + part.Name + ", " + part.UUID + ")";
|
partnames += "(" + part.Name + ", " + part.UUID + ")";
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2} with parts {3}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString(), partnames);
|
m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2} with parts {3}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString(), partnames);
|
||||||
|
foreach (SceneObjectPart part in group.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug("[SCENE]: part " + part.Name + "," + part.UUID + ", IsAttachment = true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We can only call this after adding the scene object, since the scene object references the scene
|
// We can only call this after adding the scene object, since the scene object references the scene
|
||||||
// to find out if scripts should be activated at all.
|
// to find out if scripts should be activated at all.
|
||||||
|
|
|
@ -684,6 +684,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return m_sceneGraph.AddOrUpdateObjectBySynchronization(sog);
|
return m_sceneGraph.AddOrUpdateObjectBySynchronization(sog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ObjectUpdateResult UpdateObjectBySynchronization(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
return m_sceneGraph.UpdateObjectBySynchronization(sog);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAllSceneObjectsBySync()
|
||||||
|
{
|
||||||
|
lock (Entities)
|
||||||
|
{
|
||||||
|
EntityBase[] entities = Entities.GetEntities();
|
||||||
|
foreach (EntityBase e in entities)
|
||||||
|
{
|
||||||
|
if (e is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
SceneObjectGroup sog = (SceneObjectGroup)e;
|
||||||
|
if (!sog.IsAttachment)
|
||||||
|
DeleteSceneObjectBySynchronization((SceneObjectGroup)e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//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)
|
||||||
{
|
{
|
||||||
|
@ -732,12 +754,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
|
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewSceneObjectBySync(SceneObjectGroup group, bool attachToBackup)
|
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
if(attachToBackup)
|
//if(attachToBackup)
|
||||||
group.HasGroupChanged = true;
|
// group.HasGroupChanged = true;
|
||||||
|
|
||||||
m_sceneGraph.AddSceneObjectByStateSynch(group);
|
return m_sceneGraph.AddNewSceneObjectBySync(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DebugSceneObjectGroups()
|
public void DebugSceneObjectGroups()
|
||||||
|
@ -795,7 +817,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("to link part " + part.DebugObjectPartProperties());
|
//m_log.Debug("to link part " + part.DebugObjectPartProperties());
|
||||||
m_log.Debug("to link part " + part.Name + "," + part.UUID + "; its SOG has " + part.ParentGroup.Parts + " parts");
|
string partNames = "";
|
||||||
|
foreach (SceneObjectPart child in part.ParentGroup.Parts)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
children.Add(part);
|
children.Add(part);
|
||||||
}
|
}
|
||||||
|
@ -805,7 +832,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
|
//Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
|
||||||
m_sceneGraph.LinkObjectsBySync(root, children);
|
m_sceneGraph.LinkObjectsBySync(root, children);
|
||||||
|
|
||||||
|
foreach (SceneObjectPart part in linkedGroup.Parts)
|
||||||
|
{
|
||||||
|
if (part.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug("LinkObjectBySync: part " + part.Name + "," + part.UUID + " IsAttachment = true after linking");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//The properties of the newly linked object should be updated later with another UpdatedObject message.
|
//The properties of the newly linked object should be updated later with another UpdatedObject message.
|
||||||
|
|
|
@ -2002,6 +2002,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region SYMMETRIC SYNC
|
#region SYMMETRIC SYNC
|
||||||
|
|
||||||
|
public Scene.ObjectUpdateResult UpdateObjectBySynchronization(SceneObjectGroup updatedSog)
|
||||||
|
{
|
||||||
|
UUID sogID = updatedSog.UUID;
|
||||||
|
Scene.ObjectUpdateResult updateResult = Scene.ObjectUpdateResult.Unchanged;
|
||||||
|
|
||||||
|
if (Entities.ContainsKey(sogID))
|
||||||
|
{
|
||||||
|
//update the object
|
||||||
|
EntityBase entity = Entities[sogID];
|
||||||
|
if (entity is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
SceneObjectGroup localSog = (SceneObjectGroup)entity;
|
||||||
|
updateResult = localSog.UpdateObjectGroupBySync(updatedSog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0}: Entity with {1} is not of type SceneObjectGroup: {2}",
|
||||||
|
"[SCENE GRAPH]", sogID, entity.GetType().ToString());
|
||||||
|
//return false;
|
||||||
|
updateResult = Scene.ObjectUpdateResult.Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//An object no longer in Entity list, probably linked to other objects, or handed over to another quark.
|
||||||
|
m_log.WarnFormat("[SCENE GRAPH] UpdateObjectBySynchronization: received update for an object {0}, {1} no longer in local Entity list. Ignore update.", updatedSog.Name, updatedSog.UUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateResult;
|
||||||
|
}
|
||||||
|
|
||||||
public Scene.ObjectUpdateResult AddOrUpdateObjectBySynchronization(SceneObjectGroup updatedSog)
|
public Scene.ObjectUpdateResult AddOrUpdateObjectBySynchronization(SceneObjectGroup updatedSog)
|
||||||
{
|
{
|
||||||
UUID sogID = updatedSog.UUID;
|
UUID sogID = updatedSog.UUID;
|
||||||
|
@ -2026,8 +2057,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Debug(updatedSog.Name+" "+updatedSog.UUID+" not found in Entities list. Need to add");
|
//m_log.Debug(updatedSog.Name+" "+updatedSog.UUID+" not found in Entities list. Need to add");
|
||||||
AddSceneObjectByStateSynch(updatedSog);
|
AddNewSceneObjectBySync(updatedSog);
|
||||||
updateResult = Scene.ObjectUpdateResult.New;
|
updateResult = Scene.ObjectUpdateResult.New;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2040,13 +2071,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
//This is called when an object is added due to receiving a state synchronization message from Scene or an actor. Do similar things as the original AddSceneObject(),
|
//This is called when an object is added due to receiving a state synchronization message from Scene or an actor. Do similar things as the original AddSceneObject(),
|
||||||
//but call ScheduleGroupForFullUpdate_TimeStampUnchanged() instead, so as not to modify the timestamp or actorID, since the object was not created locally.
|
//but call ScheduleGroupForFullUpdate_TimeStampUnchanged() instead, so as not to modify the timestamp or actorID, since the object was not created locally.
|
||||||
public bool AddSceneObjectByStateSynch(SceneObjectGroup sceneObject)
|
public Scene.ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
|
||||||
{
|
{
|
||||||
|
Scene.ObjectUpdateResult updateResult = Scene.ObjectUpdateResult.New;
|
||||||
|
|
||||||
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
||||||
return false;
|
return Scene.ObjectUpdateResult.Error;
|
||||||
|
|
||||||
if (Entities.ContainsKey(sceneObject.UUID))
|
if (Entities.ContainsKey(sceneObject.UUID))
|
||||||
return false;
|
{
|
||||||
|
m_log.WarnFormat("[SCENE GRAPH] AddNewSceneObjectBySync: Already has object {0}, {1} in local Entity list.", sceneObject.Name, sceneObject.UUID);
|
||||||
|
return Scene.ObjectUpdateResult.Error;
|
||||||
|
}
|
||||||
|
|
||||||
SceneObjectPart[] children = sceneObject.Parts;
|
SceneObjectPart[] children = sceneObject.Parts;
|
||||||
|
|
||||||
|
@ -2070,8 +2106,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
m_numPrim += children.Length;
|
m_numPrim += children.Length;
|
||||||
|
|
||||||
m_log.Debug("Attached obj " + sceneObject.Name + "," + sceneObject.UUID + " to Scene");
|
|
||||||
|
|
||||||
sceneObject.AttachToScene(m_parentScene);
|
sceneObject.AttachToScene(m_parentScene);
|
||||||
|
|
||||||
//Take some special care of the case of this object being an attachment
|
//Take some special care of the case of this object being an attachment
|
||||||
|
@ -2113,7 +2147,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
|
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return updateResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
|
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
|
||||||
|
|
|
@ -1372,6 +1372,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SYMMETRIC SYNC
|
||||||
|
//if we are doing sync across different sync nodes, and are not told to persist the state, don't do anything (only persistence actor will do it)
|
||||||
|
if (m_scene.RegionSyncModule != null && !ToPersistObjectState)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//end of SYMMETRIC SYNC
|
||||||
|
|
||||||
// Since this is the top of the section of call stack for backing up a particular scene object, don't let
|
// Since this is the top of the section of call stack for backing up a particular scene object, don't let
|
||||||
// any exception propogate upwards.
|
// any exception propogate upwards.
|
||||||
try
|
try
|
||||||
|
@ -2113,9 +2121,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;
|
||||||
|
|
||||||
|
@ -3556,6 +3564,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region SYMMETRIC SYNC
|
#region SYMMETRIC SYNC
|
||||||
|
|
||||||
|
private bool m_toPersistObjectState = false;
|
||||||
|
public bool ToPersistObjectState
|
||||||
|
{
|
||||||
|
get { return m_toPersistObjectState; }
|
||||||
|
set { m_toPersistObjectState = value; }
|
||||||
|
}
|
||||||
|
|
||||||
//update the existing copy of the object with updated properties in 'updatedSog'
|
//update the existing copy of the object with updated properties in 'updatedSog'
|
||||||
//NOTE: updates on script content are handled seperately (e.g. user edited the script and saved it) -- SESyncServerOnUpdateScript(), a handler of EventManager.OnUpdateScript
|
//NOTE: updates on script content are handled seperately (e.g. user edited the script and saved it) -- SESyncServerOnUpdateScript(), a handler of EventManager.OnUpdateScript
|
||||||
//public void UpdateObjectProperties(SceneObjectGroup updatedSog)
|
//public void UpdateObjectProperties(SceneObjectGroup updatedSog)
|
||||||
|
@ -3847,7 +3862,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
bool newGroupBySync = true;
|
bool newGroupBySync = true;
|
||||||
SceneObjectGroup objectGroup = new SceneObjectGroup(delinkPart, newGroupBySync);
|
SceneObjectGroup objectGroup = new SceneObjectGroup(delinkPart, newGroupBySync);
|
||||||
|
|
||||||
m_scene.AddNewSceneObjectBySync(objectGroup, true);
|
m_scene.AddNewSceneObjectBySync(objectGroup);
|
||||||
|
|
||||||
if (sendEvents)
|
if (sendEvents)
|
||||||
linkPart.TriggerScriptChangedEvent(Changed.LINK);
|
linkPart.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
|
|
@ -2202,7 +2202,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PhysicsCollision(EventArgs e)
|
public virtual void PhysicsCollision(EventArgs e)
|
||||||
{
|
{
|
||||||
// single threaded here
|
// single threaded here
|
||||||
if (e == null)
|
if (e == null)
|
||||||
|
@ -2795,6 +2795,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_parentGroup.AbsolutePosition = newpos;
|
m_parentGroup.AbsolutePosition = newpos;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat("[PHYSICS]: TerseUpdate: UUID={0}, newpos={1}", PhysActor.UUID.ToString(), newpos.ToString());
|
// m_log.DebugFormat("[PHYSICS]: TerseUpdate: UUID={0}, newpos={1}", PhysActor.UUID.ToString(), newpos.ToString());
|
||||||
//m_parentGroup.RootPart.m_groupPosition = newpos;
|
//m_parentGroup.RootPart.m_groupPosition = newpos;
|
||||||
}
|
}
|
||||||
|
@ -5003,7 +5004,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//lock for concurrent updates of the timestamp and actorID.
|
//lock for concurrent updates of the timestamp and actorID.
|
||||||
private Object m_updateLock = new Object();
|
private Object m_updateLock = new Object();
|
||||||
private string m_bucketName;
|
private string m_bucketName;
|
||||||
private bool m_bucketTainted = false;
|
private bool m_bucketLocallyTainted = false; //indicating if the bucket has been tainted by local write operations
|
||||||
|
private bool m_bucketTaintedBySync = false; //indicating if the bucket has been tainted by remote write operations (propogated by synchronization)
|
||||||
|
|
||||||
public long LastUpdateTimeStamp
|
public long LastUpdateTimeStamp
|
||||||
{
|
{
|
||||||
|
@ -5022,9 +5024,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_bucketName; }
|
get { return m_bucketName; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Tainted
|
public bool LocallyTainted
|
||||||
{
|
{
|
||||||
get { return m_bucketTainted; }
|
get { return m_bucketLocallyTainted; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TaintedBySync
|
||||||
|
{
|
||||||
|
get { return m_bucketTaintedBySync; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public BucketSyncInfo(string bucketName)
|
public BucketSyncInfo(string bucketName)
|
||||||
|
@ -5045,17 +5052,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_lastUpdateTimeStamp = timeStamp;
|
m_lastUpdateTimeStamp = timeStamp;
|
||||||
m_lastUpdateActorID = actorID;
|
m_lastUpdateActorID = actorID;
|
||||||
m_bucketTainted = false; //clear taint
|
m_bucketLocallyTainted = false; //clear taint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TaintBucket()
|
public void TaintBucketLocally()
|
||||||
{
|
{
|
||||||
lock (m_updateLock)
|
lock (m_updateLock)
|
||||||
{
|
{
|
||||||
m_bucketTainted = true;
|
m_bucketLocallyTainted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TaintBucketBySync()
|
||||||
|
{
|
||||||
|
m_bucketTaintedBySync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearBucketTaintBySync()
|
||||||
|
{
|
||||||
|
m_bucketTaintedBySync = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -5462,6 +5479,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
localPart.TextureAnimation = updatedPart.TextureAnimation;
|
localPart.TextureAnimation = updatedPart.TextureAnimation;
|
||||||
localPart.ParticleSystem = updatedPart.ParticleSystem;
|
localPart.ParticleSystem = updatedPart.ParticleSystem;
|
||||||
|
|
||||||
|
bool preIsAttachment = localPart.IsAttachment;
|
||||||
|
|
||||||
if (!localPart.AttachedAvatar.Equals(updatedPart.AttachedAvatar))
|
if (!localPart.AttachedAvatar.Equals(updatedPart.AttachedAvatar))
|
||||||
{
|
{
|
||||||
localPart.AttachedAvatar = updatedPart.AttachedAvatar;
|
localPart.AttachedAvatar = updatedPart.AttachedAvatar;
|
||||||
|
@ -5477,7 +5496,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// localPart.IsAttachment = updatedPart.IsAttachment;
|
// localPart.IsAttachment = updatedPart.IsAttachment;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
if (localPart.IsAttachment)
|
||||||
|
{
|
||||||
|
m_log.Debug("GeneralBucketUpdateProcessor: part " + localPart.Name + "," + localPart.UUID + ", IsAttachment = true; previously, IsAttachment = " + preIsAttachment.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;
|
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;
|
||||||
|
aggregateScriptEventSubscriptions();
|
||||||
|
|
||||||
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
|
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
|
||||||
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;
|
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;
|
||||||
|
@ -5497,8 +5522,40 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// are kept the same as in the received copy of the object.
|
// are kept the same as in the received copy of the object.
|
||||||
ScheduleFullUpdate(null);
|
ScheduleFullUpdate(null);
|
||||||
|
|
||||||
|
//Mark the bucket as having been tainted by sync operations
|
||||||
|
m_bucketSyncInfoList[bucketName].TaintBucketBySync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do any subscriptions based on the AggregateScriptEvents
|
||||||
|
protected void aggregateScriptEventSubscriptions()
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
|
||||||
|
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
|
||||||
|
(CollisionSound != UUID.Zero)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// subscribe to physics updates.
|
||||||
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
|
PhysActor.OnCollisionUpdate += PhysicsCollision;
|
||||||
|
PhysActor.SubscribeEvents(1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PhysActor != null)
|
||||||
|
{
|
||||||
|
PhysActor.UnSubscribeEvents();
|
||||||
|
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//NOTE: only touch the properties and BucketSyncInfo that is related to the given bucketName. Other properties and
|
//NOTE: only touch the properties and BucketSyncInfo that is related to the given bucketName. Other properties and
|
||||||
//buckets may not be filled at all in "updatedPart".
|
//buckets may not be filled at all in "updatedPart".
|
||||||
|
@ -5540,7 +5597,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
localPart.AngularVelocity = data["AngularVelocity"].AsVector3();
|
localPart.AngularVelocity = data["AngularVelocity"].AsVector3();
|
||||||
localPart.RotationOffset = data["RotationOffset"].AsQuaternion();
|
localPart.RotationOffset = data["RotationOffset"].AsQuaternion();
|
||||||
|
|
||||||
if (pa != null)
|
//m_log.Debug("Received Physics Bucket updates for " + localPart.Name + ","+localPart.UUID
|
||||||
|
// + ". GroupPosition: " + data["GroupPosition"].AsVector3().ToString());
|
||||||
|
|
||||||
|
if (pa != null && data.ContainsKey("PA_Acceleration"))
|
||||||
{
|
{
|
||||||
pa.Size = data["Size"].AsVector3();
|
pa.Size = data["Size"].AsVector3();
|
||||||
pa.Position = data["Position"].AsVector3();
|
pa.Position = data["Position"].AsVector3();
|
||||||
|
@ -5556,6 +5616,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
pa.Buoyancy = (float)data["Buoyancy"].AsReal();
|
pa.Buoyancy = (float)data["Buoyancy"].AsReal();
|
||||||
pa.CollidingGround = data["CollidingGround"].AsBoolean();
|
pa.CollidingGround = data["CollidingGround"].AsBoolean();
|
||||||
pa.IsColliding = data["IsColliding"].AsBoolean();
|
pa.IsColliding = data["IsColliding"].AsBoolean();
|
||||||
|
|
||||||
|
// m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor for {2},{3}. pos={1}", , data["Position"].AsVector3().ToString(), localPart.Name, localPart.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = data["LastUpdateTimeStamp"].AsLong();
|
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = data["LastUpdateTimeStamp"].AsLong();
|
||||||
|
@ -5572,6 +5634,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
ScheduleFullUpdate(null);
|
ScheduleFullUpdate(null);
|
||||||
|
|
||||||
|
//Mark the bucket as having been tainted by sync operations
|
||||||
|
m_bucketSyncInfoList[bucketName].TaintBucketBySync();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialize and set the values of timestamp and actorID for each synchronization bucket.
|
//Initialize and set the values of timestamp and actorID for each synchronization bucket.
|
||||||
|
@ -5626,7 +5690,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (BucketSyncInfo bucketSynInfo in m_bucketSyncInfoList.Values)
|
foreach (BucketSyncInfo bucketSynInfo in m_bucketSyncInfoList.Values)
|
||||||
{
|
{
|
||||||
bucketSynInfo.TaintBucket();
|
bucketSynInfo.TaintBucketLocally();
|
||||||
}
|
}
|
||||||
// m_log.DebugFormat("{0}: TaintBucketSyncInfo: FullUpdate", "[SCENE OBJECT PART]");
|
// m_log.DebugFormat("{0}: TaintBucketSyncInfo: FullUpdate", "[SCENE OBJECT PART]");
|
||||||
}
|
}
|
||||||
|
@ -5634,7 +5698,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
string bucketName = m_primPropertyBucketMap[property];
|
string bucketName = m_primPropertyBucketMap[property];
|
||||||
//m_bucketSyncTainted[bucketName] = true;
|
//m_bucketSyncTainted[bucketName] = true;
|
||||||
m_bucketSyncInfoList[bucketName].TaintBucket();
|
m_bucketSyncInfoList[bucketName].TaintBucketLocally();
|
||||||
|
|
||||||
|
// m_log.Debug(this.Name + ": " + property.ToString() + " just changed. Tainted " + bucketName);
|
||||||
|
|
||||||
// m_log.DebugFormat("{0}: TaintBucketSyncInfo: tainting bucket {1} for {2}",
|
// m_log.DebugFormat("{0}: TaintBucketSyncInfo: tainting bucket {1} for {2}",
|
||||||
// "[SCENE OBJECT PART]", bucketName, property.ToString());
|
// "[SCENE OBJECT PART]", bucketName, property.ToString());
|
||||||
}
|
}
|
||||||
|
@ -5642,11 +5709,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool HasPropertyUpdatedLocallyInGivenBucket(string bucketName)
|
public bool HasPropertyUpdatedLocally(string bucketName)
|
||||||
{
|
{
|
||||||
return m_bucketSyncInfoList[bucketName].Tainted;
|
return m_bucketSyncInfoList[bucketName].LocallyTainted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasPropertyUpdatedBySync(string bucketName)
|
||||||
|
{
|
||||||
|
return m_bucketSyncInfoList[bucketName].TaintedBySync;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the timestamp information of each property bucket, and clear out the taint on each bucket.
|
/// Update the timestamp information of each property bucket, and clear out the taint on each bucket.
|
||||||
|
@ -5659,7 +5730,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList)
|
foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList)
|
||||||
{
|
{
|
||||||
string bucketName = pair.Key;
|
string bucketName = pair.Key;
|
||||||
if (m_bucketSyncInfoList[bucketName].Tainted)
|
if (m_bucketSyncInfoList[bucketName].LocallyTainted)
|
||||||
{
|
{
|
||||||
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
||||||
}
|
}
|
||||||
|
@ -5680,7 +5751,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList)
|
foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList)
|
||||||
{
|
{
|
||||||
string bucketName = pair.Key;
|
string bucketName = pair.Key;
|
||||||
if (m_bucketSyncInfoList[bucketName].Tainted)
|
if (m_bucketSyncInfoList[bucketName].LocallyTainted)
|
||||||
{
|
{
|
||||||
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
||||||
}
|
}
|
||||||
|
@ -5692,7 +5763,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (m_syncEnabled)
|
if (m_syncEnabled)
|
||||||
{
|
{
|
||||||
if (m_bucketSyncInfoList[bucketName].Tainted)
|
if (m_bucketSyncInfoList[bucketName].LocallyTainted)
|
||||||
{
|
{
|
||||||
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
m_bucketSyncInfoList[bucketName].UpdateSyncInfoAndClearTaint(timeStamp, m_localActorID);
|
||||||
}
|
}
|
||||||
|
@ -5767,8 +5838,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (!m_bucketSyncInfoList[bucketName].LastUpdateActorID.Equals(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID))
|
if (!m_bucketSyncInfoList[bucketName].LastUpdateActorID.Equals(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID))
|
||||||
{
|
{
|
||||||
m_log.Warn("Different actors modified SceneObjetPart " + UUID + " with the same TimeStamp (" + m_bucketSyncInfoList[bucketName].LastUpdateActorID
|
m_log.Warn("Different actors modified SceneObjetPart " + Name+"," +UUID + ", bucket "+bucketName+", with the same TimeStamp ("
|
||||||
+ "," + updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID + ", CONFLICT RESOLUTION TO BE IMPLEMENTED, PICK A WINNER!!!!");
|
+ m_bucketSyncInfoList[bucketName].LastUpdateActorID
|
||||||
|
+ "," + updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID +
|
||||||
|
", CONFLICT RESOLUTION TO BE IMPLEMENTED, PICK A WINNER!!!!");
|
||||||
}
|
}
|
||||||
//TODO: conflict resolution to be implemented -- pick a winner
|
//TODO: conflict resolution to be implemented -- pick a winner
|
||||||
continue;
|
continue;
|
||||||
|
@ -5821,8 +5894,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
if (!m_bucketSyncInfoList[bucketName].LastUpdateActorID.Equals(rBucketSyncInfo.LastUpdateActorID))
|
if (!m_bucketSyncInfoList[bucketName].LastUpdateActorID.Equals(rBucketSyncInfo.LastUpdateActorID))
|
||||||
{
|
{
|
||||||
m_log.Warn("Different actors modified SceneObjetPart " + UUID + " with the same TimeStamp (" + m_bucketSyncInfoList[bucketName].LastUpdateActorID
|
m_log.Warn("UpdateBucketProperties: Different actors modified SceneObjetPart " + Name + "," + UUID + ", bucket " + bucketName + ", with the same TimeStamp ("
|
||||||
+ "," + rBucketSyncInfo.LastUpdateActorID + ", CONFLICT RESOLUTION TO BE IMPLEMENTED, PICK A WINNER!!!!");
|
+ m_bucketSyncInfoList[bucketName].LastUpdateActorID
|
||||||
|
+ "," + rBucketSyncInfo.LastUpdateActorID +
|
||||||
|
", CONFLICT RESOLUTION TO BE IMPLEMENTED, PICK A WINNER!!!!");
|
||||||
}
|
}
|
||||||
//TODO: conflict resolution to be implemented -- pick a winner
|
//TODO: conflict resolution to be implemented -- pick a winner
|
||||||
return partUpdateResult;
|
return partUpdateResult;
|
||||||
|
@ -5907,6 +5982,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PhysicsCollision(EventArgs e)
|
||||||
|
{
|
||||||
|
if (m_parentGroup.Scene.RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
CollisionEventUpdate a = (CollisionEventUpdate)e;
|
||||||
|
Dictionary<uint, ContactPoint> collisionswith = a.m_objCollisionList;
|
||||||
|
OSDArray collisionLocalIDs = new OSDArray();
|
||||||
|
foreach (uint collisionObject in collisionswith.Keys)
|
||||||
|
{
|
||||||
|
collisionLocalIDs.Add(collisionObject);
|
||||||
|
}
|
||||||
|
object[] eventArgs = new object[2];
|
||||||
|
eventArgs[0] = this.UUID;
|
||||||
|
eventArgs[1] = collisionLocalIDs;
|
||||||
|
m_parentGroup.Scene.RegionSyncModule.PublishSceneEvent(EventManager.EventNames.PhysicsCollision, eventArgs);
|
||||||
|
}
|
||||||
|
PhysicsCollisionLocally(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PhysicsCollisionLocally(EventArgs e)
|
||||||
|
{
|
||||||
|
base.PhysicsCollision(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//end of SYMMETRIC SYNC
|
//end of SYMMETRIC SYNC
|
||||||
|
|
Loading…
Reference in New Issue