From 0766b6dc34b972026846360767a20e2f11325c70 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Sep 2009 20:44:43 -0700 Subject: Fixed the connection from User server to GridServer. --- .../Grid/UserServer.Modules/UserLoginService.cs | 62 +++++++++++----------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'OpenSim/Grid/UserServer.Modules/UserLoginService.cs') diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs index 01d5537..2ca5ada 100644 --- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs +++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs @@ -34,6 +34,7 @@ using System.Text.RegularExpressions; using log4net; using Nwc.XmlRpc; using OpenMetaverse; +using Nini.Config; using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Communications; @@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Capabilities; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Grid.UserServer.Modules { @@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules public UserConfig m_config; private readonly IRegionProfileRouter m_regionProfileService; + private IGridService m_GridService; + protected BaseHttpServer m_httpServer; public UserLoginService( @@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules m_defaultHomeY = m_config.DefaultY; m_interInventoryService = inventoryService; m_regionProfileService = regionProfileService; + + m_GridService = new GridServicesConnector(config.GridServerURL.ToString()); } public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) @@ -203,47 +211,37 @@ namespace OpenSim.Grid.UserServer.Modules protected override RegionInfo RequestClosestRegion(string region) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, - m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); - - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { - return null; - } + return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region)); } protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, - m_config.GridServerURL, m_config.GridSendKey, - m_config.GridRecvKey); - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { - return null; - } + uint x = 0, y = 0; + Utils.LongToUInts(homeRegionHandle, out x, out y); + return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y)); } protected override RegionInfo GetRegionInfo(UUID homeRegionId) { - RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, - m_config.GridServerURL, m_config.GridSendKey, - m_config.GridRecvKey); - if (profileData != null) - { - return profileData.ToRegionInfo(); - } - else - { + return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId)); + } + + private RegionInfo GridRegionToRegionInfo(GridRegion gregion) + { + if (gregion == null) return null; - } + + RegionInfo rinfo = new RegionInfo(); + rinfo.ExternalHostName = gregion.ExternalHostName; + rinfo.HttpPort = gregion.HttpPort; + rinfo.InternalEndPoint = gregion.InternalEndPoint; + rinfo.RegionID = gregion.RegionID; + rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize); + rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize); + rinfo.RegionName = gregion.RegionName; + rinfo.ScopeID = gregion.ScopeID; + + return rinfo; } protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient) -- cgit v1.1