mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now.
This commit is contained in:
@@ -40,6 +40,7 @@ using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
{
|
||||
@@ -108,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>();
|
||||
private IMessageTransferModule m_TransferModule = null;
|
||||
|
||||
private IGridServices m_gridServices = null;
|
||||
private IGridService m_gridServices = null;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
@@ -142,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
if (m_scenes.Count > 0)
|
||||
{
|
||||
m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>();
|
||||
m_gridServices = m_initialScene.CommsManager.GridService;
|
||||
m_gridServices = m_initialScene.GridService;
|
||||
}
|
||||
if (m_TransferModule == null)
|
||||
m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
|
||||
@@ -171,7 +172,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
List<UUID> tpdAway = new List<UUID>();
|
||||
|
||||
// destRegionHandle is a region on another server
|
||||
RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(destRegionHandle, out x, out y);
|
||||
GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
if (info != null)
|
||||
{
|
||||
string httpServer = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/presence_update_bulk";
|
||||
@@ -223,7 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
public bool TriggerTerminateFriend(ulong destRegionHandle, UUID agentID, UUID exFriendID)
|
||||
{
|
||||
// destRegionHandle is a region on another server
|
||||
RegionInfo info = m_gridServices.RequestNeighbourInfo(destRegionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(destRegionHandle, out x, out y);
|
||||
GridRegion info = m_gridServices.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
if (info == null)
|
||||
{
|
||||
m_log.WarnFormat("[OGS1 GRID SERVICES]: Couldn't find region {0}", destRegionHandle);
|
||||
|
||||
@@ -36,6 +36,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
@@ -497,7 +498,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
if (upd.AgentOnline)
|
||||
{
|
||||
RegionInfo reginfo = m_Scenes[0].SceneGridService.RequestNeighbouringRegionInfo(upd.Handle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(upd.Handle, out x, out y);
|
||||
GridRegion reginfo = m_Scenes[0].GridService.GetRegionByPosition(m_Scenes[0].RegionInfo.ScopeID,
|
||||
(int)x, (int)y);
|
||||
if (reginfo != null)
|
||||
{
|
||||
Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
|
||||
@@ -559,7 +563,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
/// <param name="reginfo">RegionInfo we pull the data out of to send the request to</param>
|
||||
/// <param name="xmlrpcdata">The Instant Message data Hashtable</param>
|
||||
/// <returns>Bool if the message was successfully delivered at the other side.</returns>
|
||||
protected virtual bool doIMSending(RegionInfo reginfo, Hashtable xmlrpcdata)
|
||||
protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata)
|
||||
{
|
||||
|
||||
ArrayList SendParams = new ArrayList();
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
@@ -171,7 +172,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
{
|
||||
// TODO this is the old messaging-server protocol; only the regionHandle is available.
|
||||
// Fetch region-info to get the id
|
||||
RegionInfo regionInfo = m_initialScene.RequestNeighbouringRegionInfo(info.regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(info.regionHandle, out x, out y);
|
||||
GridRegion regionInfo = m_initialScene.GridService.GetRegionByPosition(m_initialScene.RegionInfo.ScopeID,
|
||||
(int)x, (int)y);
|
||||
regionID = regionInfo.RegionID;
|
||||
}
|
||||
result[indices[i]] = new PresenceInfo(uuids[i], regionID);
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Framework.Services
|
||||
{
|
||||
public class RegionMapService : IRegionModule
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static bool initialized = false;
|
||||
private static bool enabled = false;
|
||||
|
||||
Scene m_scene;
|
||||
//AssetService m_assetService;
|
||||
|
||||
#region IRegionModule interface
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
m_scene = scene;
|
||||
|
||||
// This module is only on for hypergrid mode
|
||||
enabled = config.Configs["Startup"].GetBoolean("hypergrid", false);
|
||||
}
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
m_log.Info("[RegionMapService]: Starting...");
|
||||
|
||||
//m_assetService = new AssetService(m_scene);
|
||||
new GridService(m_scene);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "RegionMapService"; }
|
||||
}
|
||||
|
||||
public bool IsSharedModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
public class GridService
|
||||
{
|
||||
// private IUserService m_userService;
|
||||
private IGridServices m_gridService;
|
||||
private bool m_doLookup = false;
|
||||
|
||||
public bool DoLookup
|
||||
{
|
||||
get { return m_doLookup; }
|
||||
set { m_doLookup = value; }
|
||||
}
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public GridService(Scene m_scene)
|
||||
{
|
||||
AddHandlers(m_scene);
|
||||
// m_userService = m_scene.CommsManager.UserService;
|
||||
m_gridService = m_scene.CommsManager.GridService;
|
||||
}
|
||||
|
||||
protected void AddHandlers(Scene m_scene)
|
||||
{
|
||||
// IAssetDataPlugin m_assetProvider
|
||||
// = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin;
|
||||
|
||||
IHttpServer httpServer = MainServer.Instance;
|
||||
httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
|
||||
//m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
|
||||
//m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an XML RPC response to a simulator profile request
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
Hashtable responseData = new Hashtable();
|
||||
RegionInfo simData = null;
|
||||
if (requestData.ContainsKey("region_UUID"))
|
||||
{
|
||||
UUID regionID = new UUID((string)requestData["region_UUID"]);
|
||||
simData = m_gridService.RequestNeighbourInfo(regionID); //.GetRegion(regionID);
|
||||
if (simData == null)
|
||||
{
|
||||
m_log.WarnFormat("[HGGridService] didn't find region for regionID {0} from {1}",
|
||||
regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
|
||||
}
|
||||
}
|
||||
else if (requestData.ContainsKey("region_handle"))
|
||||
{
|
||||
//CFK: The if/else below this makes this message redundant.
|
||||
//CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]);
|
||||
ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]);
|
||||
simData = m_gridService.RequestNeighbourInfo(regionHandle); //m_gridDBService.GetRegion(regionHandle);
|
||||
if (simData == null)
|
||||
{
|
||||
m_log.WarnFormat("[HGGridService] didn't find region for regionHandle {0} from {1}",
|
||||
regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
|
||||
}
|
||||
}
|
||||
else if (requestData.ContainsKey("region_name_search"))
|
||||
{
|
||||
string regionName = (string)requestData["region_name_search"];
|
||||
List<RegionInfo> regInfos = m_gridService.RequestNamedRegions(regionName, 1);//m_gridDBService.GetRegion(regionName);
|
||||
if (regInfos != null)
|
||||
simData = regInfos[0];
|
||||
|
||||
if (simData == null)
|
||||
{
|
||||
m_log.WarnFormat("[HGGridService] didn't find region for regionName {0} from {1}",
|
||||
regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
|
||||
}
|
||||
}
|
||||
else m_log.Warn("[HGGridService] regionlookup without regionID, regionHandle or regionHame");
|
||||
|
||||
if (simData == null)
|
||||
{
|
||||
//Sim does not exist
|
||||
responseData["error"] = "Sim does not exist";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Debug("[HGGridService]: found " + (string)simData.RegionName + " regionHandle = " +
|
||||
(string)requestData["region_handle"]);
|
||||
responseData["sim_ip"] = simData.ExternalEndPoint.Address.ToString();
|
||||
responseData["sim_port"] = simData.ExternalEndPoint.Port.ToString();
|
||||
//responseData["server_uri"] = simData.serverURI;
|
||||
responseData["http_port"] = simData.HttpPort.ToString();
|
||||
//responseData["remoting_port"] = simData.remotingPort.ToString();
|
||||
responseData["region_locx"] = simData.RegionLocX.ToString();
|
||||
responseData["region_locy"] = simData.RegionLocY.ToString();
|
||||
responseData["region_UUID"] = simData.RegionID.ToString();
|
||||
responseData["region_name"] = simData.RegionName;
|
||||
responseData["region_secret"] = simData.regionSecret;
|
||||
}
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Region.CoreModules.World.WorldMap;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Hypergrid
|
||||
{
|
||||
@@ -59,7 +60,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid
|
||||
|
||||
protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
{
|
||||
List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4);
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(minX - 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize,
|
||||
(maxX + 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize);
|
||||
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
|
||||
// Different from super
|
||||
FillInMap(mapBlocks, minX, minY, maxX, maxY);
|
||||
|
||||
@@ -47,7 +47,7 @@ using Nini.Config;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
public class HGGridConnector : ISharedRegionModule, IGridService
|
||||
public class HGGridConnector : ISharedRegionModule, IGridService, IHyperlinkService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
@@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return;
|
||||
|
||||
scene.RegisterModuleInterface<IGridService>(this);
|
||||
scene.RegisterModuleInterface<IHyperlinkService>(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -367,10 +368,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Hyperlinks
|
||||
#region IHyperlinkService
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
|
||||
public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
|
||||
{
|
||||
string host = "127.0.0.1";
|
||||
@@ -417,6 +419,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// From the map search and secondlife://blah
|
||||
public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
|
||||
{
|
||||
@@ -554,6 +557,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return true;
|
||||
}
|
||||
|
||||
public GridRegion TryLinkRegion(IClientAPI client, string regionDescriptor)
|
||||
{
|
||||
return TryLinkRegion((Scene)client.Scene, client, regionDescriptor);
|
||||
}
|
||||
|
||||
public GridRegion GetHyperlinkRegion(ulong handle)
|
||||
{
|
||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||
if (r.RegionHandle == handle)
|
||||
return r;
|
||||
return null;
|
||||
}
|
||||
|
||||
public ulong FindRegionHandle(ulong handle)
|
||||
{
|
||||
foreach (GridRegion r in m_HyperlinkRegions.Values)
|
||||
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
|
||||
return m_HyperlinkHandles[r.RegionID];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
{
|
||||
@@ -161,7 +162,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
m_regionClient.SendUserInformation(regInfo, aCircuit);
|
||||
@@ -183,7 +186,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
|
||||
@@ -204,7 +209,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
|
||||
@@ -225,7 +232,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent);
|
||||
@@ -257,7 +266,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_regionClient.DoCloseAgentCall(regInfo, id);
|
||||
@@ -284,7 +295,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
// else do the remote thing
|
||||
if (!m_localBackend.IsLocalRegion(regionHandle))
|
||||
{
|
||||
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_regionClient.DoCreateObjectCall(
|
||||
@@ -798,13 +811,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit)
|
||||
public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_aScene.SceneGridService is HGSceneCommunicationService)
|
||||
{
|
||||
((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit);
|
||||
// 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
|
||||
|
||||
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||
{
|
||||
public class RemoteLandServicesConnector :
|
||||
@@ -89,7 +90,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_MapService = scene.CommsManager.GridService;
|
||||
m_GridService = scene.GridService;
|
||||
m_LocalService.AddRegion(scene);
|
||||
scene.RegisterModuleInterface<ILandService>(this);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_MapService = scene.CommsManager.GridService;
|
||||
m_LocalService.AddRegion(scene);
|
||||
scene.RegisterModuleInterface<INeighbourService>(this);
|
||||
}
|
||||
@@ -134,6 +133,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
m_GridService = scene.GridService;
|
||||
|
||||
m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName);
|
||||
|
||||
}
|
||||
|
||||
@@ -36,10 +36,12 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.Land
|
||||
{
|
||||
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
else
|
||||
{
|
||||
// a parcel request for a parcel in another region. Ask the grid about the region
|
||||
RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID);
|
||||
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
|
||||
if (info != null)
|
||||
parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
|
||||
}
|
||||
@@ -1359,9 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
}
|
||||
else
|
||||
{
|
||||
extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle,
|
||||
extLandData.x,
|
||||
extLandData.y);
|
||||
ILandService landService = m_scene.RequestModuleInterface<ILandService>();
|
||||
extLandData.landData = landService.GetLandData(extLandData.regionHandle,
|
||||
extLandData.x,
|
||||
extLandData.y);
|
||||
if (extLandData.landData == null)
|
||||
{
|
||||
// we didn't find the region/land => don't cache
|
||||
@@ -1373,20 +1376,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
if (data != null) // if we found some data, send it
|
||||
{
|
||||
RegionInfo info;
|
||||
GridRegion info;
|
||||
if (data.regionHandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
info = m_scene.RegionInfo;
|
||||
info = new GridRegion(m_scene.RegionInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
// most likely still cached from building the extLandData entry
|
||||
info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(data.regionHandle, out x, out y);
|
||||
info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
}
|
||||
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
|
||||
m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
|
||||
data.landData.Name, data.regionHandle);
|
||||
remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y);
|
||||
// HACK for now
|
||||
RegionInfo r = new RegionInfo();
|
||||
r.RegionName = info.RegionName;
|
||||
r.RegionLocX = (uint)info.RegionLocX;
|
||||
r.RegionLocY = (uint)info.RegionLocY;
|
||||
remoteClient.SendParcelInfo(r, data.landData, parcelID, data.x, data.y);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[LAND] got no parcelinfo; not sending");
|
||||
|
||||
@@ -33,6 +33,8 @@ using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
|
||||
// try to fetch from GridServer
|
||||
List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20);
|
||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20);
|
||||
if (regionInfos == null)
|
||||
{
|
||||
m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
|
||||
// service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
|
||||
regionInfos = new List<RegionInfo>();
|
||||
RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName);
|
||||
regionInfos = new List<GridRegion>();
|
||||
GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName);
|
||||
if (info != null) regionInfos.Add(info);
|
||||
}
|
||||
|
||||
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
if (mapName.Contains(".") && mapName.Contains(":"))
|
||||
{
|
||||
// It probably is a domain name. Try to link to it.
|
||||
RegionInfo regInfo;
|
||||
GridRegion regInfo;
|
||||
Scene cScene = GetClientScene(remoteClient);
|
||||
regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName);
|
||||
if (regInfo != null)
|
||||
regionInfos.Add(regInfo);
|
||||
IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>();
|
||||
if (hyperService != null)
|
||||
{
|
||||
regInfo = hyperService.TryLinkRegion(remoteClient, mapName);
|
||||
if (regInfo != null)
|
||||
regionInfos.Add(regInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,12 +128,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
MapBlockData data;
|
||||
if (regionInfos.Count > 0)
|
||||
{
|
||||
foreach (RegionInfo info in regionInfos)
|
||||
foreach (GridRegion info in regionInfos)
|
||||
{
|
||||
data = new MapBlockData();
|
||||
data.Agents = 0;
|
||||
data.Access = info.AccessLevel;
|
||||
data.MapImageId = info.RegionSettings.TerrainImageID;
|
||||
data.Access = info.Access;
|
||||
data.MapImageId = info.TerrainImage;
|
||||
data.Name = info.RegionName;
|
||||
data.RegionFlags = 0; // TODO not used?
|
||||
data.WaterHeight = 0; // not used
|
||||
|
||||
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using OSDArray=OpenMetaverse.StructuredData.OSDArray;
|
||||
using OSDMap=OpenMetaverse.StructuredData.OSDMap;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
if (lookup)
|
||||
{
|
||||
List<MapBlockData> mapBlocks;
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
|
||||
|
||||
mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8);
|
||||
avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0);
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
|
||||
|
||||
lock (cachedMapBlocks)
|
||||
cachedMapBlocks = mapBlocks;
|
||||
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
}
|
||||
if (httpserver.Length == 0)
|
||||
{
|
||||
RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionhandle, out x, out y);
|
||||
GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (mreg != null)
|
||||
{
|
||||
@@ -719,15 +732,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
List<MapBlockData> response = new List<MapBlockData>();
|
||||
|
||||
// this should return one mapblock at most. But make sure: Look whether the one we requested is in there
|
||||
List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
|
||||
if (mapBlocks != null)
|
||||
// this should return one mapblock at most.
|
||||
// (diva note: why?? in that case we should GetRegionByPosition)
|
||||
// But make sure: Look whether the one we requested is in there
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
minX * (int)Constants.RegionSize, minY * (int)Constants.RegionSize,
|
||||
maxX * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
|
||||
|
||||
if (regions != null)
|
||||
{
|
||||
foreach (MapBlockData block in mapBlocks)
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
if (block.X == minX && block.Y == minY)
|
||||
if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
|
||||
(r.RegionLocY == minY * (int)Constants.RegionSize))
|
||||
{
|
||||
// found it => add it to response
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
response.Add(block);
|
||||
break;
|
||||
}
|
||||
@@ -754,10 +775,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
|
||||
protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
|
||||
{
|
||||
List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4);
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(minX - 4) * (int)Constants.RegionSize, (minY - 4) * (int)Constants.RegionSize,
|
||||
(maxX + 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize);
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData block = new MapBlockData();
|
||||
MapBlockFromGridRegion(block, r);
|
||||
mapBlocks.Add(block);
|
||||
}
|
||||
remoteClient.SendMapBlock(mapBlocks, flag);
|
||||
}
|
||||
|
||||
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)
|
||||
{
|
||||
block.Access = r.Access;
|
||||
block.MapImageId = r.TerrainImage;
|
||||
block.Name = r.RegionName;
|
||||
block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
|
||||
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
|
||||
}
|
||||
|
||||
public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
|
||||
{
|
||||
m_log.Debug("[WORLD MAP]: Sending map image jpeg");
|
||||
@@ -874,31 +913,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
m_log.InfoFormat(
|
||||
"[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath);
|
||||
|
||||
List<MapBlockData> mapBlocks =
|
||||
m_scene.CommsManager.GridService.RequestNeighbourMapBlocks(
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 9),
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 9));
|
||||
List<MapBlockData> mapBlocks = new List<MapBlockData>();
|
||||
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
|
||||
(int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize,
|
||||
(int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize);
|
||||
List<AssetBase> textures = new List<AssetBase>();
|
||||
List<Image> bitImages = new List<Image>();
|
||||
|
||||
foreach (MapBlockData mapBlock in mapBlocks)
|
||||
foreach (GridRegion r in regions)
|
||||
{
|
||||
MapBlockData mapBlock = new MapBlockData();
|
||||
MapBlockFromGridRegion(mapBlock, r);
|
||||
AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
else
|
||||
{
|
||||
texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
if (texAsset != null)
|
||||
{
|
||||
textures.Add(texAsset);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// // WHAT?!? This doesn't seem right. Commenting (diva)
|
||||
// texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
|
||||
// if (texAsset != null)
|
||||
// {
|
||||
// textures.Add(texAsset);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
foreach (AssetBase asset in textures)
|
||||
|
||||
Reference in New Issue
Block a user