Configuration of SyncListenerIPAddress, SyncListenerPort, ServerIPAddress, and

ServerPort is moved to Regions.ini.
dsg
Huaiyu (Kitty) Liu 2011-01-17 17:13:15 -08:00
parent 719f59db3f
commit c8dc14fb01
4 changed files with 80 additions and 14 deletions

View File

@ -386,6 +386,14 @@ namespace OpenSim.Framework
public string RemotingAddress; public string RemotingAddress;
public UUID ScopeID = UUID.Zero; public UUID ScopeID = UUID.Zero;
//SYMMETRIC SYNC
//IP:port for the symmetric sync listener this actor is configured to connect to
private string m_syncListenerAddr = String.Empty;
private int m_syncListenerPort;
//IP:port for the avatar sync server this actor is configured to connect to
private string m_serverAddr = String.Empty;
private int m_serverPort;
//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.
@ -676,6 +684,25 @@ namespace OpenSim.Framework
get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
} }
//SYMMETRIC SYNC
public string SyncListenerAddress
{
get { return m_syncListenerAddr; }
}
public int SyncListenerPort
{
get { return m_syncListenerPort; }
}
public string ServerIPAddress
{
get { return m_serverAddr; }
}
public int ServerPort
{
get { return m_serverPort; }
}
//end of SYMMETRIC SYNC
public void SetEndPoint(string ipaddr, int port) public void SetEndPoint(string ipaddr, int port)
{ {
IPAddress tmpIP = IPAddress.Parse(ipaddr); IPAddress tmpIP = IPAddress.Parse(ipaddr);
@ -830,6 +857,21 @@ namespace OpenSim.Framework
// Multi-tenancy // Multi-tenancy
// //
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
// SYMMETRIC SYNC
m_syncListenerAddr = config.GetString("SyncListenerIPAddress", String.Empty);
m_syncListenerPort = config.GetInt("SyncListenerPort", -1);
//if either IP or port is not configured, we set IP to empty to raise warning later
if (m_syncListenerPort == -1)
m_syncListenerAddr = String.Empty;
m_serverAddr = config.GetString("ServerIPAddress", String.Empty);
m_serverPort = config.GetInt("ServerPort", -1);
if (m_serverPort == -1)
m_serverAddr = String.Empty;
// end of SYMMETRIC SYNC
} }
private void WriteNiniConfig(IConfigSource source) private void WriteNiniConfig(IConfigSource source)

View File

@ -69,10 +69,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_active = true; m_active = true;
m_scene.RegionSyncEnabled = true; m_scene.RegionSyncEnabled = true;
m_scene.RegionSyncMode = "client"; m_scene.RegionSyncMode = "client";
string serverAddrDefault = syncConfig.GetString("ServerIPAddress", "127.0.0.1");
m_serveraddr = syncConfig.GetString(scene.RegionInfo.RegionName+"_ServerIPAddress", serverAddrDefault); //string serverAddrDefault = syncConfig.GetString("ServerIPAddress", "127.0.0.1");
int serverPortDefault = syncConfig.GetInt("ServerPort", 13000); //m_serveraddr = syncConfig.GetString(scene.RegionInfo.RegionName+"_ServerIPAddress", serverAddrDefault);
m_serverport = syncConfig.GetInt(scene.RegionInfo.RegionName+"_ServerPort", serverPortDefault); //int serverPortDefault = syncConfig.GetInt("ServerPort", 13000);
//m_serverport = syncConfig.GetInt(scene.RegionInfo.RegionName+"_ServerPort", serverPortDefault);
m_scene.RegisterModuleInterface<IRegionSyncClientModule>(this); m_scene.RegisterModuleInterface<IRegionSyncClientModule>(this);
m_symsync = syncConfig.GetBoolean("SymSync", false); m_symsync = syncConfig.GetBoolean("SymSync", false);
@ -230,7 +232,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void Start() private void Start()
{ {
m_serveraddr = m_scene.RegionInfo.ServerIPAddress;
m_serverport = m_scene.RegionInfo.ServerPort;
if (m_serveraddr.Equals(String.Empty) || m_serverport == -1)
{
m_log.Warn("[REGION SYNC CLIENT MODULE] No IP or port of RegionSyncServer has been configured. Shut down.");
m_active = false;
return;
}
lock (m_client_lock) lock (m_client_lock)
{ {
if (m_client != null) if (m_client != null)

View File

@ -97,10 +97,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_statsWriter = File.AppendText(syncstats); m_statsWriter = File.AppendText(syncstats);
//Get sync server info for Client Manager actors //Get sync server info for Client Manager actors
string serverAddr = scene.RegionInfo.RegionName + "_ServerIPAddress"; //string serverAddr = scene.RegionInfo.RegionName + "_ServerIPAddress";
m_serveraddr = syncConfig.GetString(serverAddr, IPAddrUnknown); //m_serveraddr = syncConfig.GetString(serverAddr, IPAddrUnknown);
string serverPort = scene.RegionInfo.RegionName + "_ServerPort"; //string serverPort = scene.RegionInfo.RegionName + "_ServerPort";
m_serverport = syncConfig.GetInt(serverPort, PortUnknown); //m_serverport = syncConfig.GetInt(serverPort, PortUnknown);
// Client manager load balancing // Client manager load balancing
m_maxClientsPerManager = syncConfig.GetInt("MaxClientsPerManager", 100); m_maxClientsPerManager = syncConfig.GetInt("MaxClientsPerManager", 100);
DefaultPort++; DefaultPort++;
@ -154,6 +155,11 @@ 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_serverport = m_scene.RegionInfo.ServerPort;
m_log.Debug("[REGION SYNC SERVER MODULE] to start server on " + m_serveraddr + ":" + m_serverport);
if (!m_serveraddr.Equals(IPAddrUnknown) && m_serverport != PortUnknown) if (!m_serveraddr.Equals(IPAddrUnknown) && m_serverport != PortUnknown)
{ {
m_log.Warn("[REGION SYNC SERVER MODULE] Starting RegionSyncServer"); m_log.Warn("[REGION SYNC SERVER MODULE] Starting RegionSyncServer");

View File

@ -377,7 +377,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
private static int PortUnknown = -1; private static int PortUnknown = -1;
private static string IPAddrUnknown = ""; private static string IPAddrUnknown = String.Empty;
private ILog m_log; private ILog m_log;
//private bool m_active = true; //private bool m_active = true;
@ -563,8 +563,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_log.Debug("reading in " + m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress" + " and " + m_scene.RegionInfo.RegionName + "_SyncListenerPort"); m_log.Debug("reading in " + m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress" + " and " + m_scene.RegionInfo.RegionName + "_SyncListenerPort");
string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName+"_SyncListenerIPAddress", IPAddrUnknown); //string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName+"_SyncListenerIPAddress", IPAddrUnknown);
int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName+"_SyncListenerPort", PortUnknown); //int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName+"_SyncListenerPort", PortUnknown);
string addr = m_scene.RegionInfo.SyncListenerAddress;
int port = m_scene.RegionInfo.SyncListenerPort;
m_log.Warn(LogHeader + ", listener addr: " + addr + ", port: " + port); m_log.Warn(LogHeader + ", listener addr: " + addr + ", port: " + port);
@ -586,8 +589,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
//For now, we assume there is only one remote listener to connect to. Later on, //For now, we assume there is only one remote listener to connect to. Later on,
//we may need to modify the code to read in multiple listeners. //we may need to modify the code to read in multiple listeners.
string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress", IPAddrUnknown); //string addr = m_sysConfig.GetString(m_scene.RegionInfo.RegionName + "_SyncListenerIPAddress", IPAddrUnknown);
int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName + "_SyncListenerPort", PortUnknown); //int port = m_sysConfig.GetInt(m_scene.RegionInfo.RegionName + "_SyncListenerPort", PortUnknown);
string addr = m_scene.RegionInfo.SyncListenerAddress;
int port = m_scene.RegionInfo.SyncListenerPort;
if (!addr.Equals(IPAddrUnknown) && port != PortUnknown) if (!addr.Equals(IPAddrUnknown) && port != PortUnknown)
{ {
RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port);