Merge branch 'dev_kitty' into dev

dsg
Huaiyu (Kitty) Liu 2011-01-20 12:08:15 -08:00
commit 67858f0dcd
8 changed files with 174 additions and 49 deletions

View File

@ -391,8 +391,10 @@ namespace OpenSim.Framework
private string m_syncListenerAddr = String.Empty; private string m_syncListenerAddr = String.Empty;
private int m_syncListenerPort; private int m_syncListenerPort;
//IP:port for the avatar sync server this actor is configured to connect to //IP:port for the avatar sync server this actor is configured to connect to
private string m_serverAddr = String.Empty; private string m_avatarSyncServerAddr = String.Empty;
private int m_serverPort; private int m_avatarSyncServerPort;
private uint m_quarkLocX;
private uint m_quarkLocY;
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
@ -693,13 +695,25 @@ namespace OpenSim.Framework
{ {
get { return m_syncListenerPort; } get { return m_syncListenerPort; }
} }
public string ServerIPAddress public string AvatarSyncServerAddress
{ {
get { return m_serverAddr; } get { return m_avatarSyncServerAddr; }
} }
public int ServerPort public int AvatarSyncServerPort
{ {
get { return m_serverPort; } get { return m_avatarSyncServerPort; }
}
public uint SyncQuarkLocationX
{
get { return m_quarkLocX; }
set { m_quarkLocX = value; }
}
public uint SyncQuarkLocationY
{
get { return m_quarkLocY; }
set { m_quarkLocY = value; }
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
@ -859,16 +873,24 @@ namespace OpenSim.Framework
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
// SYMMETRIC SYNC // SYMMETRIC SYNC
m_syncListenerAddr = config.GetString("SyncListenerIPAddress", String.Empty); m_syncListenerAddr = config.GetString("SyncListenerAddress", String.Empty);
m_syncListenerPort = config.GetInt("SyncListenerPort", -1); m_syncListenerPort = config.GetInt("SyncListenerPort", -1);
//if either IP or port is not configured, we set IP to empty to raise warning later //if either IP or port is not configured, we set IP to empty to raise warning later
if (m_syncListenerPort == -1) if (m_syncListenerPort == -1)
m_syncListenerAddr = String.Empty; m_syncListenerAddr = String.Empty;
m_serverAddr = config.GetString("ServerIPAddress", String.Empty); m_avatarSyncServerAddr = config.GetString("AvatarSyncServerAddress", String.Empty);
m_serverPort = config.GetInt("ServerPort", -1); m_avatarSyncServerPort = config.GetInt("AvatarSyncServerPort", -1);
if (m_serverPort == -1) if (m_avatarSyncServerPort == -1)
m_serverAddr = String.Empty; m_avatarSyncServerAddr = String.Empty;
string quarkLocation = config.GetString("SyncQuarkLocation", String.Empty);
string[] quarkLocElements = location.Split(new char[] { ',' });
m_quarkLocX = Convert.ToUInt32(quarkLocElements[0]);
m_quarkLocY = Convert.ToUInt32(quarkLocElements[1]);
// end of SYMMETRIC SYNC // end of SYMMETRIC SYNC

View File

@ -232,8 +232,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void Start() private void Start()
{ {
m_serveraddr = m_scene.RegionInfo.ServerIPAddress; m_serveraddr = m_scene.RegionInfo.AvatarSyncServerAddress;
m_serverport = m_scene.RegionInfo.ServerPort; m_serverport = m_scene.RegionInfo.AvatarSyncServerPort;
if (m_serveraddr.Equals(String.Empty) || m_serverport == -1) if (m_serveraddr.Equals(String.Empty) || m_serverport == -1)
{ {

View File

@ -166,8 +166,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
// Start the server and listen for RegionSyncClients // Start the server and listen for RegionSyncClients
m_serveraddr = m_scene.RegionInfo.ServerIPAddress; m_serveraddr = m_scene.RegionInfo.AvatarSyncServerAddress;
m_serverport = m_scene.RegionInfo.ServerPort; m_serverport = m_scene.RegionInfo.AvatarSyncServerPort;
m_log.Debug("[REGION SYNC SERVER MODULE] to start server on " + m_serveraddr + ":" + m_serverport); m_log.Debug("[REGION SYNC SERVER MODULE] to start server on " + m_serveraddr + ":" + m_serverport);

View File

@ -1013,7 +1013,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
// Get the data from message and error check // Get the data from message and error check
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
string init_actorID = data["actorID"].AsString();
if (data == null) if (data == null)
{ {
@ -1023,12 +1022,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
UUID sogUUID = data["UUID"].AsUUID(); UUID sogUUID = data["UUID"].AsUUID();
string init_actorID = data["actorID"].AsString();
bool softDelete = data["softDelete"].AsBoolean();
SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID); SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogUUID);
if (sog != null) if (sog != null)
{
if (!softDelete)
{ {
m_scene.DeleteSceneObjectBySynchronization(sog); m_scene.DeleteSceneObjectBySynchronization(sog);
} }
else
{
m_scene.UnlinkSceneObject(sog, true);
}
}
//if this is a relay node, forwards the event //if this is a relay node, forwards the event
if (m_isSyncRelay) if (m_isSyncRelay)
@ -1331,7 +1339,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// </summary> /// </summary>
/// <param name="sog"></param> /// <param name="sog"></param>
//private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) //private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog)
public void SendDeleteObject(SceneObjectGroup sog) public void SendDeleteObject(SceneObjectGroup sog, bool softDelete)
{ {
//m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); //m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond);
@ -1344,6 +1352,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//data["localID"] = OSD.FromUInteger(sog.LocalId); //data["localID"] = OSD.FromUInteger(sog.LocalId);
data["UUID"] = OSD.FromUUID(sog.UUID); data["UUID"] = OSD.FromUUID(sog.UUID);
data["actorID"] = OSD.FromString(m_actorID); data["actorID"] = OSD.FromString(m_actorID);
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);

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Interfaces
//void SendUpdatesToSynchronizeState(List<SceneObjectGroup> sog); //void SendUpdatesToSynchronizeState(List<SceneObjectGroup> sog);
void SendSceneUpdates(); void SendSceneUpdates();
void SendTerrainUpdates(string lastUpdateActorID); void SendTerrainUpdates(string lastUpdateActorID);
void SendDeleteObject(SceneObjectGroup sog); void SendDeleteObject(SceneObjectGroup sog, bool softDelete);
//For propogating scene events to other actors //For propogating scene events to other actors
void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs); void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs);

View File

@ -709,6 +709,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
{
//assign a local ID.
newPart.LocalId = AllocateLocalId();
//add it to SceneGraph's record.
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
}
#endregion //SYMMETRIC SYNC #endregion //SYMMETRIC SYNC
public ICapabilitiesModule CapsModule public ICapabilitiesModule CapsModule
@ -2475,7 +2484,7 @@ namespace OpenSim.Region.Framework.Scenes
//Propagate the RemovedObject message //Propagate the RemovedObject message
if (RegionSyncModule != null) if (RegionSyncModule != null)
{ {
RegionSyncModule.SendDeleteObject(group); RegionSyncModule.SendDeleteObject(group, false);
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC

View File

@ -1945,7 +1945,7 @@ namespace OpenSim.Region.Framework.Scenes
if (entity is SceneObjectGroup) if (entity is SceneObjectGroup)
{ {
SceneObjectGroup localSog = (SceneObjectGroup)entity; SceneObjectGroup localSog = (SceneObjectGroup)entity;
Scene.ObjectUpdateResult updateResult = localSog.UpdateObjectAllProperties(updatedSog); Scene.ObjectUpdateResult updateResult = localSog.UpdateObjectGroupBySync(updatedSog);
return updateResult; return updateResult;
} }
else else
@ -2027,6 +2027,26 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
{
SceneObjectPart[] children = parentGroup.Parts;
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[parentGroup.UUID] = parentGroup;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[newPart.UUID] = parentGroup;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[parentGroup.LocalId] = parentGroup;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[newPart.LocalId] = parentGroup;
}
}
#endregion //SYMMETRIC SYNC #endregion //SYMMETRIC SYNC
} }
} }

View File

@ -2125,6 +2125,12 @@ namespace OpenSim.Region.Framework.Scenes
//HasGroupChanged = true; //HasGroupChanged = true;
//ScheduleGroupForFullUpdate(); //ScheduleGroupForFullUpdate();
//SYMMETRIC SYNC
if (m_scene.RegionSyncModule != null)
m_scene.RegionSyncModule.SendDeleteObject(objectGroup, true);
//end of SYMMETRIC SYNC
} }
/// <summary> /// <summary>
@ -3474,10 +3480,11 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
/// <param name="updatedSog"></param> /// <param name="updatedSog"></param>
/// <returns></returns> /// <returns></returns>
public Scene.ObjectUpdateResult UpdateObjectAllProperties(SceneObjectGroup updatedSog) public Scene.ObjectUpdateResult UpdateObjectGroupBySync(SceneObjectGroup updatedSog)
{ {
if (!this.GroupID.Equals(updatedSog.GroupID)) //This GroupID check should be done by the actor who initiates the object update
return Scene.ObjectUpdateResult.Error; //if (!this.GroupID.Equals(updatedSog.GroupID))
// return Scene.ObjectUpdateResult.Error;
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
//NOTE!!! //NOTE!!!
@ -3494,16 +3501,84 @@ namespace OpenSim.Region.Framework.Scenes
bool partsRemoved = false; //has any old part been removed? bool partsRemoved = false; //has any old part been removed?
bool rootPartChanged = false; //has the rootpart be changed to a different prim? bool rootPartChanged = false; //has the rootpart be changed to a different prim?
lock (m_parts) lock (m_parts.SyncRoot)
{ {
//update rootpart, if changed //update rootpart, if changed
/*
if (m_rootPart.UUID != updatedSog.RootPart.UUID) if (m_rootPart.UUID != updatedSog.RootPart.UUID)
{ {
m_rootPart = updatedSog.RootPart; m_rootPart = updatedSog.RootPart;
rootPartChanged = true; rootPartChanged = true;
} }
* */
//foreach (KeyValuePair<UUID, SceneObjectPart> pair in updatedSog.Parts) //foreach (KeyValuePair<UUID, SceneObjectPart> pair in updatedSog.Parts)
Dictionary<UUID, SceneObjectPart> remainedParts = new Dictionary<UUID, SceneObjectPart>();
Dictionary<UUID, SceneObjectPart> removedParts = new Dictionary<UUID, SceneObjectPart>();
Dictionary<UUID, SceneObjectPart> newParts = new Dictionary<UUID, SceneObjectPart>();
//Compare the parts in updatedSog and sort them into remained/removed/newParts groups
foreach (SceneObjectPart updatedPart in updatedSog.Parts)
{
UUID partUUID = updatedPart.UUID;
if (ContainsPart(partUUID))
{
SceneObjectPart localPart = GetChildPart(partUUID);
remainedParts.Add(partUUID, localPart);
}
else
{
//in case the part is in the SceneGraph already
SceneObjectPart localPart = m_scene.GetSceneObjectPart(partUUID);
if(localPart!=null)
newParts.Add(partUUID, localPart);
else
newParts.Add(partUUID, updatedPart);
}
}
foreach (SceneObjectPart localPart in this.Parts)
{
if (!remainedParts.ContainsKey(localPart.UUID))
removedParts.Add(localPart.UUID, localPart);
}
//Add in new parts
foreach (SceneObjectPart newPart in newParts.Values)
{
//AddPart(newPart);
AddNewPart(newPart);
}
//remove parts that are no longer in the group -- !!!!! need to further test how to do correct book-keeping and synchornized with other actors !!!!!!!!
foreach (SceneObjectPart rmPart in removedParts.Values)
{
DelinkFromGroup(rmPart, true);
}
if (newParts.Count > 0 || removedParts.Count > 0)
{
groupUpdateResult = Scene.ObjectUpdateResult.Updated;
}
//now update properties of the parts
foreach (SceneObjectPart part in this.Parts)
{
Scene.ObjectUpdateResult partUpdateResult = Scene.ObjectUpdateResult.Unchanged;
SceneObjectPart updatedPart = updatedSog.GetChildPart(part.UUID);
partUpdateResult = part.UpdateAllProperties(updatedPart);
if (partUpdateResult != Scene.ObjectUpdateResult.Unchanged)
{
groupUpdateResult = partUpdateResult;
}
}
//Just to make sure the parts each has the right localID of the rootpart
UpdateParentIDs();
/*
//old code below
foreach (SceneObjectPart updatedPart in updatedSog.Parts) foreach (SceneObjectPart updatedPart in updatedSog.Parts)
{ {
UUID partUUID = updatedPart.UUID; UUID partUUID = updatedPart.UUID;
@ -3547,26 +3622,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
UpdateParentIDs(); UpdateParentIDs();
} }
}
if (partsRemoved)
{
groupUpdateResult = Scene.ObjectUpdateResult.Updated;
}
/*
//update the authoritative scene that this object is located, which is identified by (LocX, LocY)
if (this.m_locX != updatedSog.LocX)
{
this.m_locX = updatedSog.LocX;
groupUpdateResult = Scene.ObjectUpdateResult.Updated;
}
if (this.m_locY != updatedSog.LocY)
{
this.m_locY = updatedSog.LocY;
groupUpdateResult = Scene.ObjectUpdateResult.Updated;
}
* */ * */
}
//Schedule updates to be sent out, if the local copy has just been updated //Schedule updates to be sent out, if the local copy has just been updated
//(1) if we are debugging the actor with a viewer attaching to it, //(1) if we are debugging the actor with a viewer attaching to it,
@ -3581,6 +3638,14 @@ namespace OpenSim.Region.Framework.Scenes
return groupUpdateResult; return groupUpdateResult;
} }
private void AddNewPart(SceneObjectPart newPart)
{
//set the parent relationship
AddPart(newPart);
m_scene.AddNewSceneObjectPart(newPart, this);
}
public void ScheduleGroupForFullUpdate_SyncInfoUnchanged() public void ScheduleGroupForFullUpdate_SyncInfoUnchanged()
{ {
if (IsAttachment) if (IsAttachment)