mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Fixed the connection from User server to GridServer.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user