Make ISimulationScene.GetScene() used the more efficient region id for lookup rather than the region handle.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-05-24 01:00:18 +01:00
parent 17cc7e85e2
commit 7692ccc0cc
6 changed files with 31 additions and 13 deletions

View File

@ -160,16 +160,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#region ISimulation #region ISimulation
public IScene GetScene(ulong regionhandle) public IScene GetScene(UUID regionId)
{ {
foreach (Scene s in m_scenes.Values) if (m_scenes.ContainsKey(regionId))
{ {
if (s.RegionInfo.RegionHandle == regionhandle) return m_scenes[regionId];
}
else
{
// FIXME: This was pre-existing behaviour but possibly not a good idea, since it hides an error rather
// than making it obvious and fixable. Need to see if the error message comes up in practice.
Scene s = m_scenes.Values.ToArray()[0];
m_log.ErrorFormat(
"[LOCAL SIMULATION CONNECTOR]: Region with id {0} not found. Returning {1} {2} instead",
regionId, s.RegionInfo.RegionName, s.RegionInfo.RegionID);
return s; return s;
} }
// ? weird. should not happen
return m_scenes.Values.ToArray()[0];
} }
public ISimulationService GetInnerService() public ISimulationService GetInnerService()

View File

@ -151,9 +151,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#region IInterregionComms #region IInterregionComms
public IScene GetScene(ulong handle) public IScene GetScene(UUID regionId)
{ {
return m_localBackend.GetScene(handle); return m_localBackend.GetScene(regionId);
} }
public ISimulationService GetInnerService() public ISimulationService GetInnerService()

View File

@ -541,7 +541,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentData agent = new AgentData(); AgentData agent = new AgentData();
try try
{ {
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -561,7 +561,7 @@ namespace OpenSim.Server.Handlers.Simulation
AgentPosition agent = new AgentPosition(); AgentPosition agent = new AgentPosition();
try try
{ {
agent.Unpack(args, m_SimulationService.GetScene(destination.RegionHandle)); agent.Unpack(args, m_SimulationService.GetScene(destination.RegionID));
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -161,7 +161,7 @@ namespace OpenSim.Server.Handlers.Simulation
if (args.ContainsKey("extra") && args["extra"] != null) if (args.ContainsKey("extra") && args["extra"] != null)
extraStr = args["extra"].AsString(); extraStr = args["extra"].AsString();
IScene s = m_SimulationService.GetScene(destination.RegionHandle); IScene s = m_SimulationService.GetScene(destination.RegionID);
ISceneObject sog = null; ISceneObject sog = null;
try try
{ {

View File

@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors.Simulation
//m_Region = region; //m_Region = region;
} }
public IScene GetScene(ulong regionHandle) public IScene GetScene(UUID regionId)
{ {
return null; return null;
} }

View File

@ -35,7 +35,17 @@ namespace OpenSim.Services.Interfaces
{ {
public interface ISimulationService public interface ISimulationService
{ {
IScene GetScene(ulong regionHandle); /// <summary>
/// Retrieve the scene with the given region ID.
/// </summary>
/// <param name='regionId'>
/// Region identifier.
/// </param>
/// <returns>
/// The scene.
/// </returns>
IScene GetScene(UUID regionId);
ISimulationService GetInnerService(); ISimulationService GetInnerService();
#region Agents #region Agents