Fixed the connection from User server to GridServer.

0.6.8-post-fixes
Diva Canto 2009-09-27 20:44:43 -07:00
parent e15a9b8484
commit 0766b6dc34
2 changed files with 33 additions and 32 deletions

View File

@ -34,6 +34,7 @@ using System.Text.RegularExpressions;
using log4net; using log4net;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenMetaverse; using OpenMetaverse;
using Nini.Config;
using OpenSim.Data; using OpenSim.Data;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Grid.UserServer.Modules namespace OpenSim.Grid.UserServer.Modules
{ {
@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules
public UserConfig m_config; public UserConfig m_config;
private readonly IRegionProfileRouter m_regionProfileService; private readonly IRegionProfileRouter m_regionProfileService;
private IGridService m_GridService;
protected BaseHttpServer m_httpServer; protected BaseHttpServer m_httpServer;
public UserLoginService( public UserLoginService(
@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules
m_defaultHomeY = m_config.DefaultY; m_defaultHomeY = m_config.DefaultY;
m_interInventoryService = inventoryService; m_interInventoryService = inventoryService;
m_regionProfileService = regionProfileService; m_regionProfileService = regionProfileService;
m_GridService = new GridServicesConnector(config.GridServerURL.ToString());
} }
public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers) public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers)
@ -203,47 +211,37 @@ namespace OpenSim.Grid.UserServer.Modules
protected override RegionInfo RequestClosestRegion(string region) protected override RegionInfo RequestClosestRegion(string region)
{ {
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region, return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region));
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
if (profileData != null)
{
return profileData.ToRegionInfo();
}
else
{
return null;
}
} }
protected override RegionInfo GetRegionInfo(ulong homeRegionHandle) protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
{ {
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle, uint x = 0, y = 0;
m_config.GridServerURL, m_config.GridSendKey, Utils.LongToUInts(homeRegionHandle, out x, out y);
m_config.GridRecvKey); return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y));
if (profileData != null)
{
return profileData.ToRegionInfo();
}
else
{
return null;
}
} }
protected override RegionInfo GetRegionInfo(UUID homeRegionId) protected override RegionInfo GetRegionInfo(UUID homeRegionId)
{ {
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId, return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId));
m_config.GridServerURL, m_config.GridSendKey, }
m_config.GridRecvKey);
if (profileData != null) private RegionInfo GridRegionToRegionInfo(GridRegion gregion)
{ {
return profileData.ToRegionInfo(); if (gregion == null)
}
else
{
return 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) protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)

View File

@ -980,6 +980,8 @@
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/> <Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Grid.Framework"/> <Reference name="OpenSim.Grid.Framework"/>
<Reference name="OpenSim.Grid.Communications.OGS1"/> <Reference name="OpenSim.Grid.Communications.OGS1"/>
<Reference name="OpenMetaverse.dll"/> <Reference name="OpenMetaverse.dll"/>
@ -988,6 +990,7 @@
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="log4net.dll"/> <Reference name="log4net.dll"/>
<Reference name="DotNetOpenId.dll"/> <Reference name="DotNetOpenId.dll"/>
<Reference name="Nini.dll"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>