mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
Moved all HG1 operations to HGGridConnector.cs and HypergridServerConnector.cs/HypergridServiceConnector.cs, away from Region.Communications and HGNetworkServersInfo.
Fixed small bugs with hyperlinked regions' map positions.
This commit is contained in:
@@ -43,12 +43,11 @@ namespace OpenSim
|
||||
public class HGCommands
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public static IHyperlink HGServices = null;
|
||||
|
||||
public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager,
|
||||
StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version)
|
||||
{
|
||||
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices);
|
||||
HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager);
|
||||
|
||||
return
|
||||
new HGScene(
|
||||
|
||||
@@ -596,16 +596,16 @@ namespace OpenSim.Region.Communications.Hypergrid
|
||||
//m_log.Debug(" >> " + loginParams["region_uuid"] + " <<");
|
||||
//m_log.Debug(" --------- ---------------- -------");
|
||||
|
||||
string serverURI = "";
|
||||
if (u.UserProfile is ForeignUserProfileData)
|
||||
serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
|
||||
loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;
|
||||
//string serverURI = "";
|
||||
//if (u.UserProfile is ForeignUserProfileData)
|
||||
// serverURI = Util.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
|
||||
//loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;
|
||||
|
||||
serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
|
||||
loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;
|
||||
//serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
|
||||
//loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;
|
||||
|
||||
serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
|
||||
loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;
|
||||
//serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
|
||||
//loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;
|
||||
|
||||
loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;
|
||||
|
||||
@@ -949,33 +949,35 @@ namespace OpenSim.Region.Communications.Hypergrid
|
||||
|
||||
protected bool IsComingHome(ForeignUserProfileData userData)
|
||||
{
|
||||
return (userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI);
|
||||
return false; //(userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI);
|
||||
}
|
||||
|
||||
protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo)
|
||||
{
|
||||
if (uinfo.UserProfile == null)
|
||||
return false;
|
||||
return false;
|
||||
//if (uinfo.UserProfile == null)
|
||||
// return false;
|
||||
|
||||
string userUserServerURI = String.Empty;
|
||||
if (uinfo.UserProfile is ForeignUserProfileData)
|
||||
{
|
||||
userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
||||
}
|
||||
//string userUserServerURI = String.Empty;
|
||||
//if (uinfo.UserProfile is ForeignUserProfileData)
|
||||
//{
|
||||
// userUserServerURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
||||
//}
|
||||
|
||||
return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) &&
|
||||
(userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI));
|
||||
//return ((uinfo.UserProfile.HomeRegionID == rinfo.RegionID) &&
|
||||
// (userUserServerURI != HGNetworkServersInfo.Singleton.LocalUserServerURI));
|
||||
}
|
||||
|
||||
protected bool IsLocalUser(CachedUserInfo uinfo)
|
||||
{
|
||||
if (uinfo == null)
|
||||
return true;
|
||||
return true;
|
||||
//if (uinfo == null)
|
||||
// return true;
|
||||
|
||||
if (uinfo.UserProfile is ForeignUserProfileData)
|
||||
return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
||||
else
|
||||
return true;
|
||||
//if (uinfo.UserProfile is ForeignUserProfileData)
|
||||
// return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
||||
//else
|
||||
// return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
using OpenSim.Server.Handlers.Base;
|
||||
using OpenSim.Server.Handlers.Grid;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||
@@ -95,20 +96,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (!m_Registered)
|
||||
{
|
||||
m_Registered = true;
|
||||
|
||||
m_log.Info("[HypergridService]: Starting...");
|
||||
|
||||
Object[] args = new Object[] { m_Config, MainServer.Instance };
|
||||
|
||||
m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance);
|
||||
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
||||
}
|
||||
|
||||
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
||||
m_HypergridHandler.AddRegion(rinfo);
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
@@ -122,6 +109,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
if (!m_Registered)
|
||||
{
|
||||
m_Registered = true;
|
||||
|
||||
m_log.Info("[HypergridService]: Starting...");
|
||||
|
||||
Object[] args = new Object[] { m_Config, MainServer.Instance };
|
||||
|
||||
m_HypergridHandler = new HypergridServiceInConnector(m_Config, MainServer.Instance, scene.RequestModuleInterface<IHyperlinkService>());
|
||||
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
||||
}
|
||||
|
||||
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
||||
m_HypergridHandler.AddRegion(rinfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -31,6 +31,7 @@ using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
@@ -52,10 +53,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static string LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI;
|
||||
|
||||
private bool m_Enabled = false;
|
||||
private bool m_Initialized = false;
|
||||
|
||||
private Scene m_aScene;
|
||||
private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
|
||||
|
||||
private IGridService m_GridServiceConnector;
|
||||
private HypergridServiceConnector m_HypergridServiceConnector;
|
||||
|
||||
@@ -141,6 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
|
||||
scene.RegisterModuleInterface<IGridService>(this);
|
||||
scene.RegisterModuleInterface<IHyperlinkService>(this);
|
||||
|
||||
@@ -148,6 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
public void RemoveRegion(Scene scene)
|
||||
{
|
||||
m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
|
||||
}
|
||||
|
||||
public void RegionLoaded(Scene scene)
|
||||
@@ -157,7 +164,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_aScene = scene;
|
||||
LocalAssetServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
|
||||
LocalInventoryServerURI = m_aScene.CommsManager.NetworkServersInfo.InventoryURL;
|
||||
LocalUserServerURI = m_aScene.CommsManager.NetworkServersInfo.UserURL;
|
||||
|
||||
m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
|
||||
|
||||
HGCommands hgCommands = new HGCommands(this, scene);
|
||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
|
||||
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
||||
@@ -167,6 +180,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
"Unlink a hypergrid region", hgCommands.RunCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
|
||||
"Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
||||
|
||||
// Yikes!! Remove this as soon as user services get refactored
|
||||
HGNetworkServersInfo.Init(LocalAssetServerURI, LocalInventoryServerURI, LocalUserServerURI);
|
||||
|
||||
m_Initialized = true;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +257,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
// Try the foreign users home collection
|
||||
foreach (GridRegion r in m_knownRegions.Values)
|
||||
if (r.RegionID == regionID)
|
||||
return m_knownRegions[regionID];
|
||||
return r;
|
||||
|
||||
// Finally, try the normal route
|
||||
return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
||||
@@ -261,7 +278,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
foreach (GridRegion r in m_knownRegions.Values)
|
||||
{
|
||||
if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, try the normal route
|
||||
@@ -328,8 +347,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
||||
{
|
||||
m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo);
|
||||
m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
|
||||
m_HyperlinkRegions[regionInfo.RegionID] = regionInfo;
|
||||
m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
||||
}
|
||||
|
||||
private void RemoveHyperlinkRegion(UUID regionID)
|
||||
@@ -340,8 +359,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
|
||||
{
|
||||
m_knownRegions.Add(userID, regionInfo);
|
||||
m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
|
||||
m_knownRegions[userID] = regionInfo;
|
||||
m_HyperlinkHandles[regionInfo.RegionID] = regionHandle;
|
||||
}
|
||||
|
||||
private void RemoveHyperlinkHomeRegion(UUID regionID)
|
||||
@@ -412,7 +431,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
// From the map search and secondlife://blah
|
||||
public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
|
||||
{
|
||||
int xloc = random.Next(0, Int16.MaxValue);
|
||||
int xloc = random.Next(0, Int16.MaxValue) * (int) Constants.RegionSize;
|
||||
return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
|
||||
}
|
||||
|
||||
@@ -563,10 +582,206 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
|
||||
return m_HyperlinkHandles[r.RegionID];
|
||||
|
||||
foreach (GridRegion r in m_knownRegions.Values)
|
||||
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
|
||||
return m_HyperlinkHandles[r.RegionID];
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData)
|
||||
{
|
||||
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
|
||||
|
||||
if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) ||
|
||||
(!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
|
||||
{
|
||||
m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
|
||||
|
||||
// Set the position of the region on the remote grid
|
||||
ulong realHandle = FindRegionHandle(regInfo.RegionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regInfo.RegionHandle, out x, out y);
|
||||
GridRegion clonedRegion = new GridRegion(regInfo);
|
||||
clonedRegion.RegionLocX = (int)x;
|
||||
clonedRegion.RegionLocY = (int)y;
|
||||
|
||||
// Get the user's home region information
|
||||
GridRegion home = m_aScene.GridService.GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID);
|
||||
|
||||
// Get the user's service URLs
|
||||
string serverURI = "";
|
||||
if (uinfo.UserProfile is ForeignUserProfileData)
|
||||
serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
|
||||
string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI;
|
||||
|
||||
string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI);
|
||||
if ((assetServer == null) || (assetServer == ""))
|
||||
assetServer = LocalAssetServerURI;
|
||||
|
||||
string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
if ((inventoryServer == null) || (inventoryServer == ""))
|
||||
inventoryServer = LocalInventoryServerURI;
|
||||
|
||||
if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer))
|
||||
{
|
||||
m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//if ((uinfo == null) || !IsGoingHome(uinfo, regInfo))
|
||||
//{
|
||||
// m_log.Info("[HGrid]: User seems to be going to foreign region.");
|
||||
// if (!InformRegionOfUser(regInfo, agentData))
|
||||
// {
|
||||
// m_log.Warn("[HGrid]: Could not inform remote region of transferring user.");
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
// m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
||||
|
||||
// May need to change agent's name
|
||||
if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null))
|
||||
{
|
||||
agentData.firstname = agentData.firstname + "." + agentData.lastname;
|
||||
agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AdjustUserInformation(AgentCircuitData agentData)
|
||||
{
|
||||
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID);
|
||||
if ((uinfo != null) && (uinfo.UserProfile != null) &&
|
||||
(IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
|
||||
{
|
||||
//m_log.Debug("---------------> Local User!");
|
||||
string[] parts = agentData.firstname.Split(new char[] { '.' });
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
agentData.firstname = parts[0];
|
||||
agentData.lastname = parts[1];
|
||||
}
|
||||
}
|
||||
//else
|
||||
// m_log.Debug("---------------> Foreign User!");
|
||||
}
|
||||
|
||||
// Check if a local user exists with the same UUID as the incoming foreign user
|
||||
public bool CheckUserAtEntry(UUID userID, UUID sessionID, out bool comingHome)
|
||||
{
|
||||
comingHome = false;
|
||||
if (!m_aScene.SceneGridService.RegionLoginsEnabled)
|
||||
return false;
|
||||
|
||||
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
{
|
||||
// uh-oh we have a potential intruder
|
||||
if (uinfo.SessionID != sessionID)
|
||||
// can't have a foreigner with a local UUID
|
||||
return false;
|
||||
else
|
||||
// oh, so it's you! welcome back
|
||||
comingHome = true;
|
||||
}
|
||||
|
||||
// OK, user can come in
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AcceptUser(ForeignUserProfileData user, GridRegion home)
|
||||
{
|
||||
m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user);
|
||||
ulong realHandle = home.RegionHandle;
|
||||
// Change the local coordinates
|
||||
// X=0 on the map
|
||||
home.RegionLocX = 0;
|
||||
home.RegionLocY = random.Next(0, 10000) * (int)Constants.RegionSize;
|
||||
|
||||
AddHyperlinkHomeRegion(user.ID, home, realHandle);
|
||||
|
||||
DumpUserData(user);
|
||||
DumpRegionData(home);
|
||||
|
||||
}
|
||||
|
||||
public bool IsLocalUser(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
return IsLocalUser(uinfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHyperlink Misc
|
||||
|
||||
protected bool IsComingHome(ForeignUserProfileData userData)
|
||||
{
|
||||
return (userData.UserServerURI == LocalUserServerURI);
|
||||
}
|
||||
|
||||
// Is the user going back to the home region or the home grid?
|
||||
protected bool IsGoingHome(CachedUserInfo uinfo, GridRegion rinfo)
|
||||
{
|
||||
if (uinfo.UserProfile == null)
|
||||
return false;
|
||||
|
||||
if (!(uinfo.UserProfile is ForeignUserProfileData))
|
||||
// it's a home user, can't be outside to return home
|
||||
return false;
|
||||
|
||||
// OK, it's a foreign user with a ForeignUserProfileData
|
||||
// and is going back to exactly the home region.
|
||||
// We can't check if it's going back to a non-home region
|
||||
// of the home grid. That will be dealt with in the
|
||||
// receiving end
|
||||
return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID);
|
||||
}
|
||||
|
||||
protected bool IsLocalUser(CachedUserInfo uinfo)
|
||||
{
|
||||
if (uinfo == null)
|
||||
return false;
|
||||
|
||||
return !(uinfo.UserProfile is ForeignUserProfileData);
|
||||
|
||||
}
|
||||
|
||||
protected bool IsLocalRegion(ulong handle)
|
||||
{
|
||||
return m_LocalScenes.ContainsKey(handle);
|
||||
}
|
||||
|
||||
private void DumpUserData(ForeignUserProfileData userData)
|
||||
{
|
||||
m_log.Info(" ------------ User Data Dump ----------");
|
||||
m_log.Info(" >> Name: " + userData.FirstName + " " + userData.SurName);
|
||||
m_log.Info(" >> HomeID: " + userData.HomeRegionID);
|
||||
m_log.Info(" >> UserServer: " + userData.UserServerURI);
|
||||
m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
|
||||
m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
|
||||
m_log.Info(" ------------ -------------- ----------");
|
||||
}
|
||||
|
||||
private void DumpRegionData(GridRegion rinfo)
|
||||
{
|
||||
m_log.Info(" ------------ Region Data Dump ----------");
|
||||
m_log.Info(" >> handle: " + rinfo.RegionHandle);
|
||||
m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
|
||||
m_log.Info(" >> external host name: " + rinfo.ExternalHostName);
|
||||
m_log.Info(" >> http port: " + rinfo.HttpPort);
|
||||
m_log.Info(" >> external EP address: " + rinfo.ExternalEndPoint.Address);
|
||||
m_log.Info(" >> external EP port: " + rinfo.ExternalEndPoint.Port);
|
||||
m_log.Info(" ------------ -------------- ----------");
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -824,29 +824,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
|
||||
public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_aScene.SceneGridService is HGSceneCommunicationService)
|
||||
{
|
||||
// big hack for now
|
||||
RegionInfo r = new RegionInfo();
|
||||
r.ExternalHostName = regInfo.ExternalHostName;
|
||||
r.HttpPort = regInfo.HttpPort;
|
||||
r.RegionID = regInfo.RegionID;
|
||||
r.RegionLocX = (uint)regInfo.RegionLocX;
|
||||
r.RegionLocY = (uint)regInfo.RegionLocY;
|
||||
((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(r, aCircuit);
|
||||
}
|
||||
}
|
||||
catch // Bad cast
|
||||
{ }
|
||||
if (m_hyperlinkService != null)
|
||||
m_hyperlinkService.SendUserInformation(regInfo, aCircuit);
|
||||
|
||||
}
|
||||
|
||||
public override void AdjustUserInformation(AgentCircuitData aCircuit)
|
||||
{
|
||||
if (m_aScene.SceneGridService is HGSceneCommunicationService)
|
||||
((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit);
|
||||
if (m_hyperlinkService != null)
|
||||
m_hyperlinkService.AdjustUserInformation(aCircuit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -525,7 +525,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||
return true;
|
||||
}
|
||||
|
||||
string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == ""))
|
||||
// this happens in standalone profiles, apparently
|
||||
return true;
|
||||
|
||||
string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
|
||||
string uri = m_LocalGridInventoryURI.TrimEnd('/');
|
||||
|
||||
if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
|
||||
@@ -544,7 +549,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||
if ((uinfo == null) || (uinfo.UserProfile == null))
|
||||
return invURI;
|
||||
|
||||
string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
|
||||
if ((userInventoryServerURI != null) &&
|
||||
(userInventoryServerURI != ""))
|
||||
|
||||
@@ -137,8 +137,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
data.Name = info.RegionName;
|
||||
data.RegionFlags = 0; // TODO not used?
|
||||
data.WaterHeight = 0; // not used
|
||||
data.X = (ushort)info.RegionLocX;
|
||||
data.Y = (ushort)info.RegionLocY;
|
||||
data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
|
||||
data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
|
||||
blocks.Add(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Communications.Clients;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
//using HyperGrid.Framework;
|
||||
//using OpenSim.Region.Communications.Hypergrid;
|
||||
@@ -50,6 +51,18 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IHyperlinkService m_hyper;
|
||||
IHyperlinkService HyperlinkService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_hyper == null)
|
||||
m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
|
||||
return m_hyper;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -79,22 +92,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private bool IsLocalUser(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
|
||||
if (uinfo != null)
|
||||
{
|
||||
if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
||||
return false;
|
||||
}
|
||||
|
||||
public AssetBase FetchAsset(string url, UUID assetID)
|
||||
{
|
||||
@@ -170,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Get(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsLocalUser(ownerID))
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
{
|
||||
// Get the item from the remote asset server onto the local AssetCache
|
||||
// and place an entry in m_assetMap
|
||||
@@ -228,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsLocalUser(ownerID))
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
{
|
||||
// Post the item from the local AssetCache onto the remote asset server
|
||||
// and place an entry in m_assetMap
|
||||
|
||||
@@ -38,6 +38,7 @@ using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
@@ -46,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public readonly IHyperlink m_hg;
|
||||
|
||||
public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan)
|
||||
private IHyperlinkService m_hg;
|
||||
IHyperlinkService HyperlinkService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_hg == null)
|
||||
m_hg = m_scene.RequestModuleInterface<IHyperlinkService>();
|
||||
return m_hg;
|
||||
}
|
||||
}
|
||||
|
||||
public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan)
|
||||
{
|
||||
m_hg = hg;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
/// Hypergrid mod start
|
||||
///
|
||||
///
|
||||
bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle);
|
||||
bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null);
|
||||
bool isHomeUser = true;
|
||||
ulong realHandle = regionHandle;
|
||||
CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID);
|
||||
if (uinfo != null)
|
||||
{
|
||||
isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile);
|
||||
isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID);
|
||||
realHandle = m_hg.FindRegionHandle(regionHandle);
|
||||
m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user