1. Restored SceneObjectSerializer.SOGToXml2() as in opensim trunk (master), so that objects
are serialized properly. 2. Added code to pass ActorType from a particular ActorSyncModule to RegionSyncModule.dsg
parent
dc6964444e
commit
650b0bfe54
|
@ -53,17 +53,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_actorID = m_sysConfig.GetString("ActorID", "");
|
||||
if (m_actorID == "")
|
||||
{
|
||||
m_log.Error("ActorID not defined in [RegionSyncModule] section in config file");
|
||||
m_log.Error("ActorID not defined in [RegionSyncModule] section in config file. Shutting down.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_isSyncRelay = m_sysConfig.GetBoolean("IsSyncRelay", false);
|
||||
|
||||
m_isSyncListenerLocal = m_sysConfig.GetBoolean("IsSyncListenerLocal", false);
|
||||
|
||||
m_active = true;
|
||||
|
||||
m_log.Warn("[REGION SYNC MODULE] Initialised for actor "+ m_actorID);
|
||||
|
||||
//The ActorType configuration will be read in and process by an ActorSyncModule, not here.
|
||||
}
|
||||
|
||||
//Called after Initialise()
|
||||
|
@ -127,10 +128,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
// Synchronization related members and functions, exposed through IRegionSyncModule interface
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private DSGActorTypes m_actorType;
|
||||
private DSGActorTypes m_actorType = DSGActorTypes.Unknown;
|
||||
/// <summary>
|
||||
/// The type of the actor running locally. This value will be set by an ActorSyncModule, so that
|
||||
/// no hard code needed in RegionSyncModule to recoganize the actor's type, thus make it easier
|
||||
/// to add new ActorSyncModules w/o chaning the code in RegionSyncModule.
|
||||
/// </summary>
|
||||
public DSGActorTypes DSGActorType
|
||||
{
|
||||
get { return m_actorType; }
|
||||
set { m_actorType = value; }
|
||||
}
|
||||
|
||||
private string m_actorID;
|
||||
|
@ -298,8 +305,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_remoteSyncListeners.Add(info);
|
||||
}
|
||||
|
||||
//Start SyncListener if a listener is supposed to run on this actor; Otherwise, initiate connections to remote listeners.
|
||||
private void SyncStart(Object[] args)
|
||||
{
|
||||
if (m_actorType == DSGActorTypes.Unknown)
|
||||
{
|
||||
m_log.Error(LogHeader + ": SyncStart -- ActorType not set yet. Either it's not defined in config file (DSGActorType), or the ActorSyncModule (ScenePersistenceSyncModule, etc) didn't pass it on to RegionSyncModule");
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isSyncListenerLocal)
|
||||
{
|
||||
|
@ -421,7 +434,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);
|
||||
|
||||
SendSyncMessage(SymmetricSyncMessage.MsgType.GetTerrain);
|
||||
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetObjects));
|
||||
SendSyncMessage(SymmetricSyncMessage.MsgType.GetObjects);
|
||||
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetAvatars));
|
||||
|
||||
//We'll deal with Event a bit later
|
||||
|
@ -532,8 +545,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
|
||||
private void HandleAddNewObject(SceneObjectGroup sog)
|
||||
{
|
||||
if (m_scene.AddNewSceneObject(sog, true)){
|
||||
bool attachToBackup = false;
|
||||
|
||||
//only need to persist the scene if this is the ScenePersistence
|
||||
if (m_actorType == DSGActorTypes.ScenePersistence)
|
||||
{
|
||||
attachToBackup = true;
|
||||
}
|
||||
if (m_scene.AddNewSceneObject(sog, attachToBackup))
|
||||
{
|
||||
m_log.Debug(LogHeader + ": added obj " + sog.UUID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
* */
|
||||
|
||||
public class ScenePersistenceSyncModule : INonSharedRegionModule, IScenePersistenceSyncModule
|
||||
public class ScenePersistenceSyncModule : INonSharedRegionModule, IDSGActorSyncModule
|
||||
{
|
||||
#region INonSharedRegionModule
|
||||
|
||||
|
@ -77,8 +77,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
//connect with scene
|
||||
m_scene = scene;
|
||||
|
||||
//register the module
|
||||
m_scene.RegisterModuleInterface<IScenePersistenceSyncModule>(this);
|
||||
//register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is.
|
||||
m_scene.RegisterModuleInterface<IDSGActorSyncModule>(this);
|
||||
|
||||
// Setup the command line interface
|
||||
//m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||
|
@ -88,7 +88,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
//Called after AddRegion() has been called for all region modules of the scene
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
|
||||
if (m_scene.RegionSyncModule != null)
|
||||
{
|
||||
m_scene.RegionSyncModule.DSGActorType = m_actorType;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("RegionSyncModule is not initiated!!");
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
|
@ -114,8 +121,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
|
||||
#endregion //IRegionModule
|
||||
|
||||
#region RegionSyncModule members and functions
|
||||
#region IDSGActorSyncModule members and functions
|
||||
|
||||
private DSGActorTypes m_actorType = DSGActorTypes.ScenePersistence;
|
||||
public DSGActorTypes ActorType
|
||||
{
|
||||
get { return m_actorType; }
|
||||
}
|
||||
|
||||
#endregion //INonSharedRegionModule
|
||||
|
||||
#region ScenePersistenceSyncModule memebers and functions
|
||||
private ILog m_log;
|
||||
private bool m_active = false;
|
||||
public bool Active
|
||||
|
@ -124,56 +140,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
|
||||
private Scene m_scene;
|
||||
public Scene LocalScene
|
||||
{
|
||||
get { return m_scene; }
|
||||
}
|
||||
|
||||
#endregion //INonSharedRegionModule members and functions
|
||||
}
|
||||
|
||||
/*
|
||||
public class RegionSyncListener
|
||||
{
|
||||
// Start the listener
|
||||
public void Start()
|
||||
{
|
||||
m_listenerThread = new Thread(new ThreadStart(Listen));
|
||||
m_listenerThread.Name = "RegionSyncServer Listener";
|
||||
m_log.WarnFormat("[REGION SYNC SERVER] Starting {0} thread", m_listenerThread.Name);
|
||||
m_listenerThread.Start();
|
||||
//m_log.Warn("[REGION SYNC SERVER] Started");
|
||||
#endregion //ScenePersistenceSyncModule
|
||||
}
|
||||
|
||||
|
||||
// Listen for connections from a new RegionSyncClient
|
||||
// When connected, start the ReceiveLoop for the new client
|
||||
private void Listen()
|
||||
{
|
||||
m_listener = new TcpListener(m_addr, m_port);
|
||||
|
||||
try
|
||||
{
|
||||
// Start listening for clients
|
||||
m_listener.Start();
|
||||
while (true)
|
||||
{
|
||||
// *** Move/Add TRY/CATCH to here, but we don't want to spin loop on the same error
|
||||
m_log.WarnFormat("[REGION SYNC SERVER] Listening for new connections on {0}:{1}...", m_addr.ToString(), m_port.ToString());
|
||||
TcpClient tcpclient = m_listener.AcceptTcpClient();
|
||||
IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address;
|
||||
int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port;
|
||||
|
||||
//pass the tcpclient information to RegionSyncModule, who will then create a SyncConnector
|
||||
}
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
m_log.WarnFormat("[REGION SYNC SERVER] [Listen] SocketException: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
* */
|
||||
|
||||
}
|
|
@ -406,7 +406,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
get { return m_AvatarFactory; }
|
||||
}
|
||||
#region REGION SYNC
|
||||
|
||||
|
||||
#region REGION SYNC -- Asymmetric sync, old style, depreciated ---------
|
||||
|
||||
protected IRegionSyncServerModule m_regionSyncServerModule;
|
||||
protected IRegionSyncClientModule m_regionSyncClientModule;
|
||||
|
||||
|
@ -574,6 +577,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region SYMMETRIC SYNC
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//KittyL: 12/23/2010. SYMMETRIC SYNC: Implementation for the symmetric synchronization model.
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private IRegionSyncModule m_regionSyncModule = null;
|
||||
public IRegionSyncModule RegionSyncModule
|
||||
{
|
||||
get { return m_regionSyncModule; }
|
||||
set { m_regionSyncModule = value; }
|
||||
}
|
||||
#endregion //SYMMETRIC SYNC
|
||||
|
||||
public ICapabilitiesModule CapsModule
|
||||
{
|
||||
get { return m_capsModule; }
|
||||
|
|
|
@ -1060,12 +1060,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionary<string, object> options)
|
||||
{
|
||||
writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
|
||||
|
||||
//REGION SYNG
|
||||
//Need to add LocX,LocY of the Scene that the object is located in.
|
||||
//writer.WriteStartElement(String.Empty, "LocX", String.Empty);
|
||||
//end of REGION SYGN
|
||||
|
||||
SOPToXml2(writer, sog.RootPart, options);
|
||||
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
|
||||
|
||||
sog.ForEachPart(delegate(SceneObjectPart sop)
|
||||
|
|
Loading…
Reference in New Issue