diff options
Merge branch 'master' into diva-textures
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index 9519e23..696225c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs | |||
@@ -42,6 +42,8 @@ using OpenSim.Region.Framework.Interfaces; | |||
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 43 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
44 | using OpenSim.Region.Framework.Scenes.Serialization; | 44 | using OpenSim.Region.Framework.Scenes.Serialization; |
45 | using OpenSim.Services.Interfaces; | ||
46 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | 47 | ||
46 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | 48 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion |
47 | { | 49 | { |
@@ -59,6 +61,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
59 | 61 | ||
60 | protected RegionToRegionClient m_regionClient; | 62 | protected RegionToRegionClient m_regionClient; |
61 | 63 | ||
64 | protected IHyperlinkService m_hyperlinkService; | ||
65 | |||
62 | protected bool m_safemode; | 66 | protected bool m_safemode; |
63 | protected IPAddress m_thisIP; | 67 | protected IPAddress m_thisIP; |
64 | 68 | ||
@@ -134,7 +138,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
134 | m_localBackend = new LocalInterregionComms(); | 138 | m_localBackend = new LocalInterregionComms(); |
135 | m_commsManager = scene.CommsManager; | 139 | m_commsManager = scene.CommsManager; |
136 | m_aScene = scene; | 140 | m_aScene = scene; |
137 | m_regionClient = new RegionToRegionClient(m_aScene); | 141 | m_hyperlinkService = m_aScene.RequestModuleInterface<IHyperlinkService>(); |
142 | m_regionClient = new RegionToRegionClient(m_aScene, m_hyperlinkService); | ||
138 | m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); | 143 | m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); |
139 | } | 144 | } |
140 | 145 | ||
@@ -161,7 +166,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
161 | // else do the remote thing | 166 | // else do the remote thing |
162 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 167 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
163 | { | 168 | { |
164 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 169 | uint x = 0, y = 0; |
170 | Utils.LongToUInts(regionHandle, out x, out y); | ||
171 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
165 | if (regInfo != null) | 172 | if (regInfo != null) |
166 | { | 173 | { |
167 | m_regionClient.SendUserInformation(regInfo, aCircuit); | 174 | m_regionClient.SendUserInformation(regInfo, aCircuit); |
@@ -183,7 +190,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
183 | // else do the remote thing | 190 | // else do the remote thing |
184 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 191 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
185 | { | 192 | { |
186 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 193 | uint x = 0, y = 0; |
194 | Utils.LongToUInts(regionHandle, out x, out y); | ||
195 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
187 | if (regInfo != null) | 196 | if (regInfo != null) |
188 | { | 197 | { |
189 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); | 198 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); |
@@ -204,7 +213,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
204 | // else do the remote thing | 213 | // else do the remote thing |
205 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 214 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
206 | { | 215 | { |
207 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 216 | uint x = 0, y = 0; |
217 | Utils.LongToUInts(regionHandle, out x, out y); | ||
218 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
208 | if (regInfo != null) | 219 | if (regInfo != null) |
209 | { | 220 | { |
210 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); | 221 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); |
@@ -225,7 +236,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
225 | // else do the remote thing | 236 | // else do the remote thing |
226 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 237 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
227 | { | 238 | { |
228 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 239 | uint x = 0, y = 0; |
240 | Utils.LongToUInts(regionHandle, out x, out y); | ||
241 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
229 | if (regInfo != null) | 242 | if (regInfo != null) |
230 | { | 243 | { |
231 | return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent); | 244 | return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent); |
@@ -257,7 +270,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
257 | // else do the remote thing | 270 | // else do the remote thing |
258 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 271 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
259 | { | 272 | { |
260 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 273 | uint x = 0, y = 0; |
274 | Utils.LongToUInts(regionHandle, out x, out y); | ||
275 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
261 | if (regInfo != null) | 276 | if (regInfo != null) |
262 | { | 277 | { |
263 | return m_regionClient.DoCloseAgentCall(regInfo, id); | 278 | return m_regionClient.DoCloseAgentCall(regInfo, id); |
@@ -284,7 +299,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
284 | // else do the remote thing | 299 | // else do the remote thing |
285 | if (!m_localBackend.IsLocalRegion(regionHandle)) | 300 | if (!m_localBackend.IsLocalRegion(regionHandle)) |
286 | { | 301 | { |
287 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | 302 | uint x = 0, y = 0; |
303 | Utils.LongToUInts(regionHandle, out x, out y); | ||
304 | GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
288 | if (regInfo != null) | 305 | if (regInfo != null) |
289 | { | 306 | { |
290 | return m_regionClient.DoCreateObjectCall( | 307 | return m_regionClient.DoCreateObjectCall( |
@@ -776,16 +793,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
776 | protected class RegionToRegionClient : RegionClient | 793 | protected class RegionToRegionClient : RegionClient |
777 | { | 794 | { |
778 | Scene m_aScene = null; | 795 | Scene m_aScene = null; |
796 | IHyperlinkService m_hyperlinkService; | ||
779 | 797 | ||
780 | public RegionToRegionClient(Scene s) | 798 | public RegionToRegionClient(Scene s, IHyperlinkService hyperService) |
781 | { | 799 | { |
782 | m_aScene = s; | 800 | m_aScene = s; |
801 | m_hyperlinkService = hyperService; | ||
783 | } | 802 | } |
784 | 803 | ||
785 | public override ulong GetRegionHandle(ulong handle) | 804 | public override ulong GetRegionHandle(ulong handle) |
786 | { | 805 | { |
787 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | 806 | if (m_aScene.SceneGridService is HGSceneCommunicationService) |
788 | return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(handle); | 807 | { |
808 | if (m_hyperlinkService != null) | ||
809 | return m_hyperlinkService.FindRegionHandle(handle); | ||
810 | } | ||
789 | 811 | ||
790 | return handle; | 812 | return handle; |
791 | } | 813 | } |
@@ -793,29 +815,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
793 | public override bool IsHyperlink(ulong handle) | 815 | public override bool IsHyperlink(ulong handle) |
794 | { | 816 | { |
795 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | 817 | if (m_aScene.SceneGridService is HGSceneCommunicationService) |
796 | return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.IsHyperlinkRegion(handle); | 818 | { |
797 | 819 | if ((m_hyperlinkService != null) && (m_hyperlinkService.GetHyperlinkRegion(handle) != null)) | |
820 | return true; | ||
821 | } | ||
798 | return false; | 822 | return false; |
799 | } | 823 | } |
800 | 824 | ||
801 | public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) | 825 | public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit) |
802 | { | 826 | { |
803 | try | 827 | if (m_hyperlinkService != null) |
804 | { | 828 | m_hyperlinkService.SendUserInformation(regInfo, aCircuit); |
805 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | ||
806 | { | ||
807 | ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit); | ||
808 | } | ||
809 | } | ||
810 | catch // Bad cast | ||
811 | { } | ||
812 | 829 | ||
813 | } | 830 | } |
814 | 831 | ||
815 | public override void AdjustUserInformation(AgentCircuitData aCircuit) | 832 | public override void AdjustUserInformation(AgentCircuitData aCircuit) |
816 | { | 833 | { |
817 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | 834 | if (m_hyperlinkService != null) |
818 | ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit); | 835 | m_hyperlinkService.AdjustUserInformation(aCircuit); |
819 | } | 836 | } |
820 | } | 837 | } |
821 | 838 | ||