From 047d753cd086295fdb9ab4c4d6a1a1d19fdfcc97 Mon Sep 17 00:00:00 2001 From: diva Date: Sun, 22 Mar 2009 06:31:32 +0000 Subject: Explicit tests for local regions. --- .../Communications/Local/LocalInterregionComms.cs | 9 +++ .../Communications/REST/RESTInterregionComms.cs | 67 +++++++++++++--------- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs index e5a01ef..3997258 100644 --- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs @@ -260,6 +260,15 @@ namespace OpenSim.Region.CoreModules.Communications.Local // ? weird. should not happen return m_sceneList[0].RegionInfo.RegionID; } + + public bool IsLocalRegion(ulong regionhandle) + { + foreach (Scene s in m_sceneList) + if (s.RegionInfo.RegionHandle == regionhandle) + return true; + return false; + } + #endregion } } diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index 32eedef..498ffd5 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs @@ -136,15 +136,18 @@ namespace OpenSim.Region.CoreModules.Communications.REST return true; // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) + if (!m_localBackend.IsLocalRegion(regionHandle)) { - SendUserInformation(regInfo, aCircuit); + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + SendUserInformation(regInfo, aCircuit); - return DoCreateChildAgentCall(regInfo, aCircuit); + return DoCreateChildAgentCall(regInfo, aCircuit); + } + //else + // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); } - //else - // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); return false; } @@ -155,13 +158,16 @@ namespace OpenSim.Region.CoreModules.Communications.REST return true; // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) + if (!m_localBackend.IsLocalRegion(regionHandle)) { - return DoChildAgentUpdateCall(regInfo, cAgentData); + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + return DoChildAgentUpdateCall(regInfo, cAgentData); + } + //else + // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); } - //else - // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); return false; } @@ -173,13 +179,16 @@ namespace OpenSim.Region.CoreModules.Communications.REST return true; // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) + if (!m_localBackend.IsLocalRegion(regionHandle)) { - return DoChildAgentUpdateCall(regInfo, cAgentData); + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + return DoChildAgentUpdateCall(regInfo, cAgentData); + } + //else + // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); } - //else - // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); return false; } @@ -201,13 +210,16 @@ namespace OpenSim.Region.CoreModules.Communications.REST return true; // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) + if (!m_localBackend.IsLocalRegion(regionHandle)) { - return DoCloseAgentCall(regInfo, id); + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + return DoCloseAgentCall(regInfo, id); + } + //else + // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); } - //else - // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); return false; } @@ -225,13 +237,16 @@ namespace OpenSim.Region.CoreModules.Communications.REST } // else do the remote thing - RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); - if (regInfo != null) + if (!m_localBackend.IsLocalRegion(regionHandle)) { - return DoCreateObjectCall(regInfo, sog); + RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + return DoCreateObjectCall(regInfo, sog); + } + //else + // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); } - //else - // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); return false; } -- cgit v1.1