Don't cache regions data on the other unused LocalGridServiceConnector that the module code still sets up even if we're using one directly instantiated from the RemoteGridServiceConnector.
Also improves log messages to indicate which regions are sending/receiving various neighbour protocol messages.0.7.3-extended
parent
e88e87ff63
commit
8f61da0759
|
@ -41,19 +41,16 @@ using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
{
|
{
|
||||||
public class LocalGridServicesConnector :
|
public class LocalGridServicesConnector : ISharedRegionModule, IGridService
|
||||||
ISharedRegionModule, IGridService
|
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static LocalGridServicesConnector m_MainInstance;
|
|
||||||
|
|
||||||
private IGridService m_GridService;
|
private IGridService m_GridService;
|
||||||
private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
|
private Dictionary<UUID, RegionCache> m_LocalCache = new Dictionary<UUID, RegionCache>();
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled;
|
||||||
|
|
||||||
public LocalGridServicesConnector()
|
public LocalGridServicesConnector()
|
||||||
{
|
{
|
||||||
|
@ -61,8 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public LocalGridServicesConnector(IConfigSource source)
|
public LocalGridServicesConnector(IConfigSource source)
|
||||||
{
|
{
|
||||||
m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
|
m_log.Debug("[LOCAL GRID SERVICE CONNECTOR]: LocalGridServicesConnector instantiated directly.");
|
||||||
m_MainInstance = this;
|
|
||||||
InitialiseService(source);
|
InitialiseService(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,9 +83,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
InitialiseService(source);
|
InitialiseService(source);
|
||||||
m_MainInstance = this;
|
m_log.Info("[LOCAL GRID SERVICE CONNECTOR]: Local grid connector enabled");
|
||||||
m_Enabled = true;
|
|
||||||
m_log.Info("[LOCAL GRID CONNECTOR]: Local grid connector enabled");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +93,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
IConfig assetConfig = source.Configs["GridService"];
|
IConfig assetConfig = source.Configs["GridService"];
|
||||||
if (assetConfig == null)
|
if (assetConfig == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[LOCAL GRID CONNECTOR]: GridService missing from OpenSim.ini");
|
m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
if (serviceDll == String.Empty)
|
if (serviceDll == String.Empty)
|
||||||
{
|
{
|
||||||
m_log.Error("[LOCAL GRID CONNECTOR]: No LocalServiceModule named in section GridService");
|
m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: No LocalServiceModule named in section GridService");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,16 +113,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
if (m_GridService == null)
|
if (m_GridService == null)
|
||||||
{
|
{
|
||||||
m_log.Error("[LOCAL GRID CONNECTOR]: Can't load grid service");
|
m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: Can't load grid service");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
|
// FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector
|
||||||
|
// will have instantiated us directly.
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
|
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
|
||||||
"show neighbours",
|
"show neighbours",
|
||||||
"Shows the local regions' neighbours", NeighboursCommand);
|
"Shows the local regions' neighbours", HandleShowNeighboursCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
@ -137,26 +135,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (m_Enabled)
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IGridService>(this);
|
scene.RegisterModuleInterface<IGridService>(this);
|
||||||
|
|
||||||
if (m_MainInstance == this)
|
|
||||||
{
|
|
||||||
if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
|
if (m_LocalCache.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
m_log.ErrorFormat("[LOCAL GRID CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
|
m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
|
||||||
else
|
else
|
||||||
m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
|
m_LocalCache.Add(scene.RegionInfo.RegionID, new RegionCache(scene));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (m_MainInstance == this)
|
if (!m_Enabled)
|
||||||
{
|
return;
|
||||||
|
|
||||||
m_LocalCache[scene.RegionInfo.RegionID].Clear();
|
m_LocalCache[scene.RegionInfo.RegionID].Clear();
|
||||||
m_LocalCache.Remove(scene.RegionInfo.RegionID);
|
m_LocalCache.Remove(scene.RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +239,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void NeighboursCommand(string module, string[] cmdparams)
|
public void HandleShowNeighboursCommand(string module, string[] cmdparams)
|
||||||
{
|
{
|
||||||
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
System.Text.StringBuilder caps = new System.Text.StringBuilder();
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
public RegionCache(Scene s)
|
public RegionCache(Scene s)
|
||||||
{
|
{
|
||||||
|
Util.PrintCallStack();
|
||||||
m_scene = s;
|
m_scene = s;
|
||||||
m_scene.EventManager.OnRegionUp += OnRegionUp;
|
m_scene.EventManager.OnRegionUp += OnRegionUp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,13 +125,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
uint x, y;
|
uint x, y;
|
||||||
Utils.LongToUInts(regionHandle, out x, out y);
|
Utils.LongToUInts(regionHandle, out x, out y);
|
||||||
|
|
||||||
m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from region {0} to region at {1}-{2}",
|
|
||||||
thisRegion.RegionName, x / Constants.RegionSize, y / Constants.RegionSize);
|
|
||||||
|
|
||||||
foreach (Scene s in m_Scenes)
|
foreach (Scene s in m_Scenes)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
|
||||||
|
thisRegion.RegionName, s.Name, x / Constants.RegionSize, y / Constants.RegionSize);
|
||||||
|
|
||||||
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
||||||
return s.IncomingHelloNeighbour(thisRegion);
|
return s.IncomingHelloNeighbour(thisRegion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,16 +84,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (neighbourService != null)
|
if (neighbourService != null)
|
||||||
neighbour = neighbourService.HelloNeighbour(regionhandle, region);
|
neighbour = neighbourService.HelloNeighbour(regionhandle, region);
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: No neighbour service provided for informing neigbhours of this region");
|
m_log.DebugFormat(
|
||||||
|
"[SCENE COMMUNICATION SERVICE]: No neighbour service provided for region {0} to inform neigbhours of status",
|
||||||
|
m_scene.Name);
|
||||||
|
|
||||||
if (neighbour != null)
|
if (neighbour != null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
|
m_log.DebugFormat(
|
||||||
|
"[SCENE COMMUNICATION SERVICE]: Region {0} successfully informed neighbour {1} at {2}-{3} that it is up",
|
||||||
|
m_scene.Name, neighbour.RegionName, x / Constants.RegionSize, y / Constants.RegionSize);
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnRegionUp(neighbour);
|
m_scene.EventManager.TriggerOnRegionUp(neighbour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SCENE COMMUNICATION SERVICE]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
|
m_log.WarnFormat(
|
||||||
|
"[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
|
||||||
|
x / Constants.RegionSize, y / Constants.RegionSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +108,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
||||||
|
|
||||||
List<GridRegion> neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
|
List<GridRegion> neighbours
|
||||||
m_log.DebugFormat("[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that this region is up", neighbours.Count);
|
= m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID);
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[SCENE COMMUNICATION SERVICE]: Informing {0} neighbours that region {1} is up",
|
||||||
|
neighbours.Count, m_scene.Name);
|
||||||
|
|
||||||
foreach (GridRegion n in neighbours)
|
foreach (GridRegion n in neighbours)
|
||||||
{
|
{
|
||||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||||
|
|
Loading…
Reference in New Issue