From f4bf581b96347b8d7f115eca74fa84a644eb729c Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 26 Sep 2009 21:00:51 -0700
Subject: 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.
---
.../Communications/Hypergrid/HGGridServices.cs | 50 +++++++++++-----------
1 file changed, 26 insertions(+), 24 deletions(-)
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
index 54cde0f..85bfab4 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
@@ -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;
}
--
cgit v1.1
From 989382352dc5b5b75876607f6fc2f1f753f0fd15 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 26 Sep 2009 21:14:41 -0700
Subject: Poof! on Region.Communications.Hypergrid. Grid code deleted.
---
.../Hypergrid/HGCommunicationsGridMode.cs | 9 -
.../Hypergrid/HGCommunicationsStandalone.cs | 3 -
.../Communications/Hypergrid/HGGridServices.cs | 1026 --------------------
.../Hypergrid/HGGridServicesGridMode.cs | 159 ---
.../Hypergrid/HGGridServicesStandalone.cs | 259 -----
5 files changed, 1456 deletions(-)
delete mode 100644 OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
delete mode 100644 OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
delete mode 100644 OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
index 80f2e79..002ea17 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
@@ -40,21 +40,12 @@ namespace OpenSim.Region.Communications.Hypergrid
{
public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1
{
- IHyperlink m_osw = null;
- public IHyperlink HGServices
- {
- get { return m_osw; }
- }
public HGCommunicationsGridMode(
NetworkServersInfo serversInfo,
SceneManager sman, LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
{
- // From constructor at CommunicationsOGS1
- HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, sman, m_userProfileCacheService);
- m_gridService = gridInterComms;
- m_osw = gridInterComms;
HGUserServices userServices = new HGUserServices(this);
// This plugin arrangement could eventually be configurable rather than hardcoded here.
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
index e4e12d4..f5126ca 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
@@ -44,7 +44,6 @@ namespace OpenSim.Region.Communications.Hypergrid
ConfigSettings configSettings,
NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
- HGGridServices gridService,
LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile)
: base(serversInfo, libraryRootFolder)
@@ -64,8 +63,6 @@ namespace OpenSim.Region.Communications.Hypergrid
m_avatarService = hgUserService;
m_messageService = hgUserService;
- gridService.UserProfileCache = m_userProfileCacheService;
- m_gridService = gridService;
}
}
}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
deleted file mode 100644
index 85bfab4..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ /dev/null
@@ -1,1026 +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.Drawing;
-using System.Net;
-using System.Net.Sockets;
-using System.Reflection;
-using System.Runtime.Remoting;
-using System.Security.Authentication;
-using log4net;
-using Nwc.XmlRpc;
-using OpenMetaverse;
-using OpenMetaverse.Imaging;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications;
-using OpenSim.Framework.Communications.Cache;
-using OpenSim.Framework.Servers;
-using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Communications.OGS1;
-using OpenSim.Region.Framework.Scenes;
-using OpenSim.Services.Interfaces;
-// using OpenSim.Region.Environment.Modules.Framework;
-
-namespace OpenSim.Region.Communications.Hypergrid
-{
- ///
- /// This class encapsulates the main hypergrid functions related to creating and managing
- /// hyperlinks, as well as processing all the inter-region comms between a region and
- /// an hyperlinked region.
- ///
- public class HGGridServices : IGridServices, IHyperlink
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
-
- public BaseHttpServer httpListener;
- public NetworkServersInfo serversInfo;
-
- protected List m_regionsOnInstance = new List();
-
- // Hyperlink regions are hyperlinks on the map
- protected List m_hyperlinkRegions = new List();
-
- // Known regions are home regions of visiting foreign users.
- // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when
- // the visitor goes away. They are mapped to X=0 on the map.
- // This is key-ed on agent ID
- protected Dictionary m_knownRegions = new Dictionary();
-
- protected UserProfileCacheService m_userProfileCache;
- protected SceneManager m_sceneman;
-
- private Dictionary m_queuedGridSettings = new Dictionary();
-
- public virtual string gdebugRegionName
- {
- get { return "Override me"; }
- set { ; }
- }
-
- public string rdebugRegionName
- {
- get { return _rdebugRegionName; }
- set { _rdebugRegionName = value; }
- }
- private string _rdebugRegionName = String.Empty;
-
- public virtual bool RegionLoginsEnabled
- {
- get { return true; }
- set { ; }
- }
-
- public UserProfileCacheService UserProfileCache
- {
- set { m_userProfileCache = value; }
- }
-
- private Random random;
-
- ///
- /// Contructor. Adds "expect_hg_user" and "check" xmlrpc method handlers
- ///
- ///
- public HGGridServices(NetworkServersInfo servers_info, SceneManager sman)
- {
- serversInfo = servers_info;
- m_sceneman = sman;
-
- random = new Random();
-
- MainServer.Instance.AddXmlRPCHandler("link_region", LinkRegionRequest);
- MainServer.Instance.AddXmlRPCHandler("expect_hg_user", ExpectHGUser);
-
- HGNetworkServersInfo.Init(servers_info.AssetURL, servers_info.InventoryURL, servers_info.UserURL);
- }
-
- // see IGridServices
- public virtual RegionCommsListener RegisterRegion(RegionInfo regionInfo)
- {
- // Region doesn't exist here. Trying to link remote region
-
- m_log.Info("[HGrid]: Linking remote region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort);
- regionInfo.RegionID = LinkRegion(regionInfo); // UUID.Random();
- if (!regionInfo.RegionID.Equals(UUID.Zero))
- {
- m_hyperlinkRegions.Add(regionInfo);
- m_log.Info("[HGrid]: Successfully linked to region_uuid " + regionInfo.RegionID);
-
- //Try get the map image
- GetMapImage(regionInfo);
- }
- else
- {
- m_log.Info("[HGrid]: No such region " + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "(" + regionInfo.InternalEndPoint.Port + ")");
- }
- // Note that these remote regions aren't registered in localBackend, so return null, no local listeners
- return null;
- }
-
- // see IGridServices
- public virtual bool DeregisterRegion(RegionInfo regionInfo)
- {
- if (m_hyperlinkRegions.Contains(regionInfo))
- {
- m_hyperlinkRegions.Remove(regionInfo);
- return true;
- }
- foreach (KeyValuePair kvp in m_knownRegions)
- {
- if (kvp.Value == regionInfo)
- {
- m_knownRegions.Remove(kvp.Key);
- return true;
- }
- }
- return false;
- }
-
- public virtual Dictionary GetGridSettings()
- {
- Dictionary returnGridSettings = new Dictionary();
- lock (m_queuedGridSettings)
- {
- foreach (string Dictkey in m_queuedGridSettings.Keys)
- {
- returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
- }
-
- m_queuedGridSettings.Clear();
- }
-
- return returnGridSettings;
- }
-
- // see IGridServices
- public virtual List RequestNeighbours(uint x, uint y)
- {
- List neighbours = new List();
- foreach (RegionInfo reg in m_hyperlinkRegions)
- {
- if (reg.RegionLocX != x || reg.RegionLocY != y)
- {
- //m_log.Debug("CommsManager- RequestNeighbours() - found a different region in list, checking location");
- if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
- {
- if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
- {
- neighbours.Add(reg);
- }
- }
- }
- }
-
- return neighbours;
- }
-
- ///
- /// Request information about a region.
- ///
- ///
- ///
- /// null on a failure to contact or get a response from the grid server
- /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the
- /// nature of the faiulre.
- ///
- public virtual RegionInfo RequestNeighbourInfo(UUID Region_UUID)
- {
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- if (info.RegionID == Region_UUID) return info;
- }
-
- // I don't trust region uuids to be unique...
- //foreach (RegionInfo info in m_knownRegions.Values)
- //{
- // if (info.RegionID == Region_UUID) return info;
- //}
-
- return null;
- }
-
- ///
- /// Request information about a region.
- ///
- ///
- ///
- public virtual RegionInfo RequestNeighbourInfo(ulong regionHandle)
- {
- //m_log.Debug(" >> RequestNeighbourInfo for " + regionHandle);
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- //m_log.Debug(" .. " + info.RegionHandle);
- if (info.RegionHandle == regionHandle) return info;
- }
-
- foreach (RegionInfo info in m_knownRegions.Values)
- {
- if (info.RegionHandle == regionHandle)
- {
- //m_log.Debug("XXX------ known region " + info.RegionHandle);
- return info;
- }
- }
-
- return null;
- }
-
- public virtual RegionInfo RequestNeighbourInfo(string name)
- {
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- //m_log.Debug(" .. " + info.RegionHandle);
- if (info.RegionName == name) return info;
- }
-
- foreach (RegionInfo info in m_knownRegions.Values)
- {
- if (info.RegionName == name)
- {
- //m_log.Debug("XXX------ known region " + info.RegionHandle);
- return info;
- }
- }
-
- return null;
- }
-
- public virtual RegionInfo RequestNeighbourInfo(string hostName, uint port)
- {
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- //m_log.Debug(" .. " + info.RegionHandle);
- if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
- return info;
- }
-
- foreach (RegionInfo info in m_knownRegions.Values)
- {
- if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
- {
- //m_log.Debug("XXX------ known region " + info.RegionHandle);
- return info;
- }
- }
-
- return null;
- }
-
- public virtual RegionInfo RequestClosestRegion(string regionName)
- {
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- if (info.RegionName == regionName) return info;
- }
-
- return null;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public virtual List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
- {
- List neighbours = new List();
-
- foreach (RegionInfo regInfo in m_hyperlinkRegions)
- {
- if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
- ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
- {
- MapBlockData map = new MapBlockData();
- map.Name = regInfo.RegionName;
- map.X = (ushort)regInfo.RegionLocX;
- map.Y = (ushort)regInfo.RegionLocY;
- map.WaterHeight = (byte)regInfo.RegionSettings.WaterHeight;
- map.MapImageId = regInfo.RegionSettings.TerrainImageID;
- // m_log.Debug("ImgID: " + map.MapImageId);
- map.Agents = 1;
- map.RegionFlags = 72458694;
- map.Access = regInfo.AccessLevel;
- neighbours.Add(map);
- }
- }
-
- return neighbours;
- }
-
-
- protected virtual void GetMapImage(RegionInfo info)
- {
- try
- {
- string regionimage = "regionImage" + info.RegionID.ToString();
- regionimage = regionimage.Replace("-", "");
-
- WebClient c = new WebClient();
- string uri = "http://" + info.ExternalHostName + ":" + info.HttpPort + "/index.php?method=" + regionimage;
- //m_log.Debug("JPEG: " + uri);
- c.DownloadFile(uri, info.RegionID.ToString() + ".jpg");
- Bitmap m = new Bitmap(info.RegionID.ToString() + ".jpg");
- //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
- byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
- AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString());
- info.RegionSettings.TerrainImageID = ass.FullID;
- ass.Type = (int)AssetType.Texture;
- ass.Temporary = false;
- ass.Local = true;
- ass.Data = imageData;
-
- m_sceneman.CurrentOrFirstScene.AssetService.Store(ass);
-
- }
- catch // LEGIT: Catching problems caused by OpenJPEG p/invoke
- {
- m_log.Warn("[HGrid]: Failed getting/storing map image, because it is probably already in the cache");
- }
- }
-
- // A little ugly, since this code is exactly the same as OSG1's, and we're already
- // calling that for when the region in in grid mode... (for the grid regions)
- //
- public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y)
- {
- m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}",
- regionHandle, x, y);
-
- // Remote region
-
- Hashtable hash = new Hashtable();
- hash["region_handle"] = regionHandle.ToString();
- hash["x"] = x.ToString();
- hash["y"] = y.ToString();
-
- IList paramList = new ArrayList();
- paramList.Add(hash);
- LandData landData = null;
-
- try
- {
- RegionInfo info = RequestNeighbourInfo(regionHandle);
- if (info != null) // just to be sure
- {
- XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
- string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
- XmlRpcResponse response = request.Send(uri, 10000);
- if (response.IsFault)
- {
- m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
- }
- else
- {
- hash = (Hashtable)response.Value;
- try
- {
- landData = new LandData();
- landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
- landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
- landData.Area = Convert.ToInt32(hash["Area"]);
- landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
- landData.Description = (string)hash["Description"];
- landData.Flags = Convert.ToUInt32(hash["Flags"]);
- landData.GlobalID = new UUID((string)hash["GlobalID"]);
- landData.Name = (string)hash["Name"];
- landData.OwnerID = new UUID((string)hash["OwnerID"]);
- landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
- landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
- landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
- m_log.DebugFormat("[HGrid]: Got land data for parcel {0}", landData.Name);
- }
- catch (Exception e)
- {
- m_log.Error("[HGrid]: Got exception while parsing land-data:", e);
- }
- }
- }
- else m_log.WarnFormat("[HGrid]: Couldn't find region with handle {0}", regionHandle);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[HGrid]: Couldn't contact region {0}: {1}", regionHandle, e);
- }
-
- return landData;
- }
-
- // Grid Request Processing
- public virtual List RequestNamedRegions (string name, int maxNumber)
- {
- List infos = new List();
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- if (info.RegionName.ToLower().Contains(name))
- {
- infos.Add(info);
- }
- }
- return infos;
- }
-
-
- private UUID LinkRegion(RegionInfo info)
- {
- UUID uuid = UUID.Zero;
-
- Hashtable hash = new Hashtable();
- hash["region_name"] = info.RegionName;
-
- IList paramList = new ArrayList();
- paramList.Add(hash);
-
- XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
- string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
- m_log.Debug("[HGrid]: Linking to " + uri);
- XmlRpcResponse response = request.Send(uri, 10000);
- if (response.IsFault)
- {
- m_log.ErrorFormat("[HGrid]: remote call returned an error: {0}", response.FaultString);
- }
- else
- {
- hash = (Hashtable)response.Value;
- //foreach (Object o in hash)
- // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
- try
- {
- UUID.TryParse((string)hash["uuid"], out uuid);
- info.RegionID = uuid;
- if ((string)hash["handle"] != null)
- {
- info.regionSecret = (string)hash["handle"];
- //m_log.Debug(">> HERE: " + info.regionSecret);
- }
- if (hash["region_image"] != null)
- {
- UUID img = UUID.Zero;
- UUID.TryParse((string)hash["region_image"], out img);
- info.RegionSettings.TerrainImageID = img;
- }
- if (hash["region_name"] != null)
- {
- info.RegionName = (string)hash["region_name"];
- //m_log.Debug(">> " + info.RegionName);
- }
- if (hash["internal_port"] != null)
- {
- int port = Convert.ToInt32((string)hash["internal_port"]);
- info.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port);
- //m_log.Debug(">> " + info.InternalEndPoint.ToString());
- }
- if (hash["remoting_port"] != null)
- {
- info.RemotingPort = Convert.ToUInt32(hash["remoting_port"]);
- //m_log.Debug(">> " + info.RemotingPort);
- }
-
- }
- catch (Exception e)
- {
- m_log.Error("[HGrid]: Got exception while parsing hyperlink response " + e.StackTrace);
- }
- }
- return uuid;
- }
-
- ///
- /// Someone wants to link to us
- ///
- ///
- ///
- public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- Hashtable requestData = (Hashtable)request.Params[0];
- //string host = (string)requestData["host"];
- //string portstr = (string)requestData["port"];
- string name = (string)requestData["region_name"];
-
- m_log.DebugFormat("[HGrid]: Hyperlink request");
-
-
- RegionInfo regInfo = null;
- foreach (RegionInfo r in m_regionsOnInstance)
- {
- if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower()))
- {
- regInfo = r;
- break;
- }
- }
-
- if (regInfo == null)
- regInfo = m_regionsOnInstance[0]; // Send out the first region
-
- Hashtable hash = new Hashtable();
- hash["uuid"] = regInfo.RegionID.ToString();
- hash["handle"] = regInfo.RegionHandle.ToString();
- //m_log.Debug(">> Here " + regInfo.RegionHandle);
- hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString();
- hash["region_name"] = regInfo.RegionName;
- hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
- hash["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString();
- //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port);
-
-
- XmlRpcResponse response = new XmlRpcResponse();
- response.Value = hash;
- return response;
- }
-
- public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData)
- {
- //ulong regionHandle = regInfo.RegionHandle;
- try
- {
- //regionHandle = Convert.ToUInt64(regInfo.regionSecret);
- m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret);
- }
- catch
- {
- m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret);
- }
-
- string capsPath = agentData.CapsPath;
- Hashtable loginParams = new Hashtable();
- loginParams["session_id"] = agentData.SessionID.ToString();
- loginParams["secure_session_id"] = agentData.SecureSessionID.ToString();
-
- loginParams["firstname"] = agentData.firstname;
- loginParams["lastname"] = agentData.lastname;
-
- loginParams["agent_id"] = agentData.AgentID.ToString();
- loginParams["circuit_code"] = agentData.circuitcode.ToString();
- loginParams["startpos_x"] = agentData.startpos.X.ToString();
- loginParams["startpos_y"] = agentData.startpos.Y.ToString();
- loginParams["startpos_z"] = agentData.startpos.Z.ToString();
- loginParams["caps_path"] = capsPath;
-
- CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID);
- if (u != null && u.UserProfile != null)
- {
- loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero
- //m_log.Debug(" --------- Home Region UUID -------");
- //m_log.Debug(" >> " + loginParams["region_uuid"] + " <<");
- //m_log.Debug(" --------- ---------------- -------");
-
- //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.UserInventoryURI);
- //loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;
-
- loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;
-
- RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion);
- if (rinfo != null)
- {
- loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString();
- if (!IsLocalUser(u))
- {
- loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString();
- //m_log.Debug("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret);
-
- loginParams["home_address"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress;
- loginParams["home_port"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort;
- loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort;
- }
- else
- {
- //m_log.Debug("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret);
-
- //// local user about to jump out, let's process the name
- // On second thoughts, let's not do this for the *user*; let's only do it for the *agent*
- //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname;
- //loginParams["lastname"] = serversInfo.UserURL;
-
- // local user, first time out. let's ask the grid about this user's home region
- loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString();
-
- loginParams["home_address"] = rinfo.ExternalHostName;
- m_log.Debug(" --------- Home Address -------");
- m_log.Debug(" >> " + loginParams["home_address"] + " <<");
- m_log.Debug(" --------- ------------ -------");
- loginParams["home_port"] = rinfo.HttpPort.ToString();
- loginParams["home_remoting"] = ConfigSettings.DefaultRegionRemotingPort.ToString(); ;
- }
- }
- else
- {
- m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY);
- }
- }
-
- ArrayList SendParams = new ArrayList();
- SendParams.Add(loginParams);
-
- // Send
- string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/";
- //m_log.Debug("XXX uri: " + uri);
- XmlRpcRequest request = new XmlRpcRequest("expect_hg_user", SendParams);
- XmlRpcResponse reply;
- try
- {
- reply = request.Send(uri, 6000);
- }
- catch (Exception e)
- {
- m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message);
- return false;
- }
-
- if (!reply.IsFault)
- {
- bool responseSuccess = true;
- if (reply.Value != null)
- {
- Hashtable resp = (Hashtable)reply.Value;
- if (resp.ContainsKey("success"))
- {
- if ((string)resp["success"] == "FALSE")
- {
- responseSuccess = false;
- }
- }
- }
- if (responseSuccess)
- {
- m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID);
- return true;
- }
- else
- {
- m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients");
- return false;
- }
- }
- else
- {
- m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode);
- return false;
- }
- }
-
-
- ///
- /// Received from other HGrid nodes when a user wants to teleport here. This call allows
- /// the region to prepare for direct communication from the client. Sends back an empty
- /// xmlrpc response on completion.
- /// This is somewhat similar to OGS1's ExpectUser, but with the additional task of
- /// registering the user in the local user cache.
- ///
- ///
- ///
- public XmlRpcResponse ExpectHGUser(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- Hashtable requestData = (Hashtable)request.Params[0];
- ForeignUserProfileData userData = new ForeignUserProfileData();
-
- userData.FirstName = (string)requestData["firstname"];
- userData.SurName = (string)requestData["lastname"];
- userData.ID = new UUID((string)requestData["agent_id"]);
- userData.HomeLocation = new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
- (float)Convert.ToDecimal((string)requestData["startpos_y"]),
- (float)Convert.ToDecimal((string)requestData["startpos_z"]));
-
- userData.UserServerURI = (string)requestData["userserver_id"];
- userData.UserAssetURI = (string)requestData["assetserver_id"];
- userData.UserInventoryURI = (string)requestData["inventoryserver_id"];
-
- UUID rootID = UUID.Zero;
- UUID.TryParse((string)requestData["root_folder_id"], out rootID);
- userData.RootInventoryFolderID = rootID;
-
- UUID uuid = UUID.Zero;
- UUID.TryParse((string)requestData["region_uuid"], out uuid);
- userData.HomeRegionID = uuid; // not quite comfortable about this...
- ulong userRegionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
- //userData.HomeRegion = userRegionHandle;
- userData.UserHomeAddress = (string)requestData["home_address"];
- userData.UserHomePort = (string)requestData["home_port"];
- int userhomeinternalport = Convert.ToInt32((string)requestData["internal_port"]);
- userData.UserHomeRemotingPort = (string)requestData["home_remoting"];
-
-
- m_log.DebugFormat("[HGrid]: Prepare for connection from {0} {1} (@{2}) UUID={3}",
- userData.FirstName, userData.SurName, userData.UserServerURI, userData.ID);
- m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress +
- "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort);
-
- XmlRpcResponse resp = new XmlRpcResponse();
-
- // Let's check if someone is trying to get in with a stolen local identity.
- // The need for this test is a consequence of not having truly global names :-/
- CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userData.ID);
- if ((uinfo != null) && !(uinfo.UserProfile is ForeignUserProfileData))
- {
- m_log.WarnFormat("[HGrid]: Foreign user trying to get in with local identity. Access denied.");
- Hashtable respdata = new Hashtable();
- respdata["success"] = "FALSE";
- respdata["reason"] = "Foreign user has the same ID as a local user.";
- resp.Value = respdata;
- return resp;
- }
-
- if (!RegionLoginsEnabled)
- {
- m_log.InfoFormat(
- "[HGrid]: Denying access for user {0} {1} because region login is currently disabled",
- userData.FirstName, userData.SurName);
-
- Hashtable respdata = new Hashtable();
- respdata["success"] = "FALSE";
- respdata["reason"] = "region login currently disabled";
- resp.Value = respdata;
- }
- else
- {
- // Finally, everything looks ok
- //m_log.Debug("XXX---- EVERYTHING OK ---XXX");
-
- // 1 - Preload the user data
- m_userProfileCache.PreloadUserCache(userData);
-
- if (m_knownRegions.ContainsKey(userData.ID))
- {
- // This was left here when the user departed
- m_knownRegions.Remove(userData.ID);
- }
-
- // 2 - Load the region info into list of known regions
- RegionInfo rinfo = new RegionInfo();
- rinfo.RegionID = userData.HomeRegionID;
- rinfo.ExternalHostName = userData.UserHomeAddress;
- rinfo.HttpPort = Convert.ToUInt32(userData.UserHomePort);
- rinfo.RemotingPort = Convert.ToUInt32(userData.UserHomeRemotingPort);
- rinfo.RegionID = userData.HomeRegionID;
- // X=0 on the map
- rinfo.RegionLocX = 0;
- rinfo.RegionLocY = (uint)(random.Next(0, Int32.MaxValue)); //(uint)m_knownRegions.Count;
- rinfo.regionSecret = userRegionHandle.ToString();
- //m_log.Debug("XXX--- Here: handle = " + rinfo.regionSecret);
- try
- {
- rinfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)userhomeinternalport);
- }
- catch (Exception e)
- {
- m_log.Warn("[HGrid]: Exception while constructing internal endpoint: " + e);
- }
- rinfo.RemotingAddress = rinfo.ExternalEndPoint.Address.ToString(); //userData.UserHomeAddress;
-
- if (!IsComingHome(userData))
- {
- // Change the user's home region here!!!
- userData.HomeRegion = rinfo.RegionHandle;
- }
-
- if (!m_knownRegions.ContainsKey(userData.ID))
- m_knownRegions.Add(userData.ID, rinfo);
-
- // 3 - Send the reply
- Hashtable respdata = new Hashtable();
- respdata["success"] = "TRUE";
- resp.Value = respdata;
-
- DumpUserData(userData);
- DumpRegionData(rinfo);
-
- }
-
- return resp;
- }
-
- public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData)
- {
- CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
-
- if ((IsLocalUser(uinfo) && IsHyperlinkRegion(regInfo.RegionHandle)) ||
- (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo)))
- {
- m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere");
- if (!InformRegionOfUser(regInfo, agentData))
- {
- 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) && IsHyperlinkRegion(regInfo.RegionHandle))
- {
- agentData.firstname = agentData.firstname + "." + agentData.lastname;
- agentData.lastname = "@" + serversInfo.UserURL.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI;
- }
-
- return true;
- }
-
-
- #region Methods triggered by calls from external instances
-
- ///
- ///
- ///
- ///
- ///
- ///
- public void AdjustUserInformation(AgentCircuitData agentData)
- {
- CachedUserInfo uinfo = m_userProfileCache.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!");
- }
- #endregion
-
-
- #region IHyperGrid interface
-
- public virtual bool IsHyperlinkRegion(ulong ihandle)
- {
- if (GetHyperlinkRegion(ihandle) == null)
- return false;
- else
- return true;
- }
-
- public virtual RegionInfo GetHyperlinkRegion(ulong ihandle)
- {
- foreach (RegionInfo info in m_hyperlinkRegions)
- {
- if (info.RegionHandle == ihandle)
- return info;
- }
-
- foreach (RegionInfo info in m_knownRegions.Values)
- {
- if (info.RegionHandle == ihandle)
- return info;
- }
-
- return null;
- }
-
- public virtual ulong FindRegionHandle(ulong ihandle)
- {
- long ohandle = -1;
- List rlist = new List(m_hyperlinkRegions);
- rlist.AddRange(m_knownRegions.Values);
- foreach (RegionInfo info in rlist)
- {
- if (info.RegionHandle == ihandle)
- {
- try
- {
- ohandle = Convert.ToInt64(info.regionSecret);
- m_log.Info("[HGrid] remote region " + ohandle);
- }
- catch
- {
- m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")");
- }
- break;
- }
- }
- return ohandle < 0 ? ihandle : (ulong)ohandle;
- }
- #endregion
-
- #region Misc
-
- protected bool IsComingHome(ForeignUserProfileData userData)
- {
- return false; //(userData.UserServerURI == HGNetworkServersInfo.Singleton.LocalUserServerURI);
- }
-
- protected bool IsGoingHome(CachedUserInfo uinfo, RegionInfo rinfo)
- {
- return false;
- //if (uinfo.UserProfile == null)
- // return false;
-
- //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));
- }
-
- protected bool IsLocalUser(CachedUserInfo uinfo)
- {
- return true;
- //if (uinfo == null)
- // return true;
-
- //if (uinfo.UserProfile is ForeignUserProfileData)
- // return HGNetworkServersInfo.Singleton.IsLocalUser(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI);
- //else
- // return true;
-
- }
-
- protected bool IsLocalRegion(ulong handle)
- {
- foreach (RegionInfo reg in m_regionsOnInstance)
- if (reg.RegionHandle == handle)
- return true;
- return false;
- }
-
- 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(" >> HomeHandle: " + userData.HomeRegion);
- m_log.Info(" >> HomeX: " + userData.HomeRegionX);
- m_log.Info(" >> HomeY: " + userData.HomeRegionY);
- m_log.Info(" >> UserServer: " + userData.UserServerURI);
- m_log.Info(" >> InvServer: " + userData.UserInventoryURI);
- m_log.Info(" >> AssetServer: " + userData.UserAssetURI);
- m_log.Info(" ------------ -------------- ----------");
- }
-
- private void DumpRegionData(RegionInfo rinfo)
- {
- m_log.Info(" ------------ Region Data Dump ----------");
- m_log.Info(" >> handle: " + rinfo.RegionHandle);
- m_log.Info(" >> coords: " + rinfo.RegionLocX + ", " + rinfo.RegionLocY);
- m_log.Info(" >> secret: " + rinfo.regionSecret);
- m_log.Info(" >> remoting address: " + rinfo.RemotingAddress);
- m_log.Info(" >> remoting port: " + rinfo.RemotingPort);
- 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
-
-
- }
-}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
deleted file mode 100644
index 5ce1e79..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs
+++ /dev/null
@@ -1,159 +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.Generic;
-using System.Reflection;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications.Cache;
-using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Communications.OGS1;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.Communications.Hypergrid
-{
- public class HGGridServicesGridMode : HGGridServices
- {
- //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// Encapsulate remote backend services for manipulation of grid regions
- ///
- private OGS1GridServices m_remoteBackend = null;
-
- public OGS1GridServices RemoteBackend
- {
- get { return m_remoteBackend; }
- }
-
-
- public override string gdebugRegionName
- {
- get { return m_remoteBackend.gdebugRegionName; }
- set { m_remoteBackend.gdebugRegionName = value; }
- }
-
- public override bool RegionLoginsEnabled
- {
- get { return m_remoteBackend.RegionLoginsEnabled; }
- set { m_remoteBackend.RegionLoginsEnabled = value; }
- }
-
- public HGGridServicesGridMode(NetworkServersInfo servers_info,
- SceneManager sman, UserProfileCacheService userv)
- : base(servers_info, sman)
- {
- m_remoteBackend = new OGS1GridServices(servers_info);
- m_userProfileCache = userv;
- }
-
- #region IGridServices interface
-
- public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
- {
- if (!regionInfo.RegionID.Equals(UUID.Zero))
- {
- m_regionsOnInstance.Add(regionInfo);
- return m_remoteBackend.RegisterRegion(regionInfo);
- }
- else
- return base.RegisterRegion(regionInfo);
- }
-
- public override bool DeregisterRegion(RegionInfo regionInfo)
- {
- bool success = base.DeregisterRegion(regionInfo);
- if (!success)
- success = m_remoteBackend.DeregisterRegion(regionInfo);
- return success;
- }
-
- public override List RequestNeighbours(uint x, uint y)
- {
- List neighbours = m_remoteBackend.RequestNeighbours(x, y);
- //List remotes = base.RequestNeighbours(x, y);
- //neighbours.AddRange(remotes);
-
- return neighbours;
- }
-
- public override RegionInfo RequestNeighbourInfo(UUID Region_UUID)
- {
- RegionInfo info = m_remoteBackend.RequestNeighbourInfo(Region_UUID);
- if (info == null)
- info = base.RequestNeighbourInfo(Region_UUID);
- return info;
- }
-
- public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
- {
- RegionInfo info = base.RequestNeighbourInfo(regionHandle);
- if (info == null)
- info = m_remoteBackend.RequestNeighbourInfo(regionHandle);
- return info;
- }
-
- public override RegionInfo RequestClosestRegion(string regionName)
- {
- RegionInfo info = m_remoteBackend.RequestClosestRegion(regionName);
- if (info == null)
- info = base.RequestClosestRegion(regionName);
- return info;
- }
-
- public override List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
- {
- List neighbours = m_remoteBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
- List remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
- neighbours.AddRange(remotes);
-
- return neighbours;
- }
-
- public override LandData RequestLandData(ulong regionHandle, uint x, uint y)
- {
- LandData land = m_remoteBackend.RequestLandData(regionHandle, x, y);
- if (land == null)
- land = base.RequestLandData(regionHandle, x, y);
- return land;
- }
-
- public override List RequestNamedRegions(string name, int maxNumber)
- {
- List infos = m_remoteBackend.RequestNamedRegions(name, maxNumber);
- List remotes = base.RequestNamedRegions(name, maxNumber);
- infos.AddRange(remotes);
- return infos;
- }
-
- #endregion
-
-
- }
-}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
deleted file mode 100644
index 94cfc49..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs
+++ /dev/null
@@ -1,259 +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.Net.Sockets;
-using System.Reflection;
-using System.Runtime.Remoting;
-using System.Runtime.Remoting.Channels;
-using System.Runtime.Remoting.Channels.Tcp;
-using System.Security.Authentication;
-using log4net;
-using Nwc.XmlRpc;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Framework.Servers;
-using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Communications.Local;
-using OpenSim.Region.Communications.OGS1;
-using OpenSim.Region.Framework.Scenes;
-
-namespace OpenSim.Region.Communications.Hypergrid
-{
- public class HGGridServicesStandalone : HGGridServices
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- ///
- /// Encapsulate local backend services for manipulation of local regions
- ///
- protected LocalBackEndServices m_localBackend = new LocalBackEndServices();
-
- //private Dictionary m_deadRegionCache = new Dictionary();
-
- public LocalBackEndServices LocalBackend
- {
- get { return m_localBackend; }
- }
-
- public override string gdebugRegionName
- {
- get { return m_localBackend.gdebugRegionName; }
- set { m_localBackend.gdebugRegionName = value; }
- }
-
- public override bool RegionLoginsEnabled
- {
- get { return m_localBackend.RegionLoginsEnabled; }
- set { m_localBackend.RegionLoginsEnabled = value; }
- }
-
-
- public HGGridServicesStandalone(NetworkServersInfo servers_info, BaseHttpServer httpServe, SceneManager sman)
- : base(servers_info, sman)
- {
- //Respond to Grid Services requests
- MainServer.Instance.AddXmlRPCHandler("logoff_user", LogOffUser);
- MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
- MainServer.Instance.AddXmlRPCHandler("land_data", LandData);
-
- }
-
- #region IGridServices interface
-
- public override RegionCommsListener RegisterRegion(RegionInfo regionInfo)
- {
- if (!regionInfo.RegionID.Equals(UUID.Zero))
- {
- m_regionsOnInstance.Add(regionInfo);
- return m_localBackend.RegisterRegion(regionInfo);
- }
- else
- return base.RegisterRegion(regionInfo);
-
- }
-
- public override bool DeregisterRegion(RegionInfo regionInfo)
- {
- bool success = m_localBackend.DeregisterRegion(regionInfo);
- if (!success)
- success = base.DeregisterRegion(regionInfo);
- return success;
- }
-
- public override List RequestNeighbours(uint x, uint y)
- {
- List neighbours = m_localBackend.RequestNeighbours(x, y);
- //List remotes = base.RequestNeighbours(x, y);
- //neighbours.AddRange(remotes);
-
- return neighbours;
- }
-
- public override RegionInfo RequestNeighbourInfo(UUID Region_UUID)
- {
- RegionInfo info = m_localBackend.RequestNeighbourInfo(Region_UUID);
- if (info == null)
- info = base.RequestNeighbourInfo(Region_UUID);
- return info;
- }
-
- public override RegionInfo RequestNeighbourInfo(ulong regionHandle)
- {
- RegionInfo info = m_localBackend.RequestNeighbourInfo(regionHandle);
- //m_log.Info("[HGrid] Request neighbor info, local backend returned " + info);
- if (info == null)
- info = base.RequestNeighbourInfo(regionHandle);
- return info;
- }
-
- public override RegionInfo RequestClosestRegion(string regionName)
- {
- RegionInfo info = m_localBackend.RequestClosestRegion(regionName);
- if (info == null)
- info = base.RequestClosestRegion(regionName);
- return info;
- }
-
- public override List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
- {
- //m_log.Info("[HGrid] Request map blocks " + minX + "-" + minY + "-" + maxX + "-" + maxY);
- List neighbours = m_localBackend.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
- List remotes = base.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
- neighbours.AddRange(remotes);
-
- return neighbours;
- }
-
- public override LandData RequestLandData(ulong regionHandle, uint x, uint y)
- {
- LandData land = m_localBackend.RequestLandData(regionHandle, x, y);
- if (land == null)
- land = base.RequestLandData(regionHandle, x, y);
- return land;
- }
-
- public override List RequestNamedRegions(string name, int maxNumber)
- {
- List infos = m_localBackend.RequestNamedRegions(name, maxNumber);
- List remotes = base.RequestNamedRegions(name, maxNumber);
- infos.AddRange(remotes);
- return infos;
- }
-
- #endregion
-
- #region XML Request Handlers
-
- ///
- /// A ping / version check
- ///
- ///
- ///
- public virtual XmlRpcResponse PingCheckReply(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- XmlRpcResponse response = new XmlRpcResponse();
-
- Hashtable respData = new Hashtable();
- respData["online"] = "true";
-
- m_localBackend.PingCheckReply(respData);
-
- response.Value = respData;
-
- return response;
- }
-
-
- // Grid Request Processing
- ///
- /// Ooops, our Agent must be dead if we're getting this request!
- ///
- ///
- ///
- public XmlRpcResponse LogOffUser(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- m_log.Debug("[HGrid]: LogOff User Called");
-
- Hashtable requestData = (Hashtable)request.Params[0];
- string message = (string)requestData["message"];
- UUID agentID = UUID.Zero;
- UUID RegionSecret = UUID.Zero;
- UUID.TryParse((string)requestData["agent_id"], out agentID);
- UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
-
- ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
-
- m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret, message);
-
- return new XmlRpcResponse();
- }
-
- ///
- /// Someone asked us about parcel-information
- ///
- ///
- ///
- public XmlRpcResponse LandData(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- Hashtable requestData = (Hashtable)request.Params[0];
- ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
- uint x = Convert.ToUInt32(requestData["x"]);
- uint y = Convert.ToUInt32(requestData["y"]);
- m_log.DebugFormat("[HGrid]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle);
-
- LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
- Hashtable hash = new Hashtable();
- if (landData != null)
- {
- // for now, only push out the data we need for answering a ParcelInfoReqeust
- hash["AABBMax"] = landData.AABBMax.ToString();
- hash["AABBMin"] = landData.AABBMin.ToString();
- hash["Area"] = landData.Area.ToString();
- hash["AuctionID"] = landData.AuctionID.ToString();
- hash["Description"] = landData.Description;
- hash["Flags"] = landData.Flags.ToString();
- hash["GlobalID"] = landData.GlobalID.ToString();
- hash["Name"] = landData.Name;
- hash["OwnerID"] = landData.OwnerID.ToString();
- hash["SalePrice"] = landData.SalePrice.ToString();
- hash["SnapshotID"] = landData.SnapshotID.ToString();
- hash["UserLocation"] = landData.UserLocation.ToString();
- }
-
- XmlRpcResponse response = new XmlRpcResponse();
- response.Value = hash;
- return response;
- }
-
- #endregion
-
- }
-}
--
cgit v1.1
From 620fa2b77234ae0600bbd1b4df8e520b0e87c3fa Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 26 Sep 2009 21:21:06 -0700
Subject: Poof! on OGS1 GridServices.
---
.../Communications/OGS1/CommunicationsOGS1.cs | 2 -
.../Region/Communications/OGS1/OGS1GridServices.cs | 937 ---------------------
2 files changed, 939 deletions(-)
delete mode 100644 OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index 8b5779f..c2b8f26 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -39,8 +39,6 @@ namespace OpenSim.Region.Communications.OGS1
LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
{
- OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo);
- m_gridService = gridInterComms;
// This plugin arrangement could eventually be configurable rather than hardcoded here.
OGS1UserServices userServices = new OGS1UserServices(this);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
deleted file mode 100644
index 47c7fe4..0000000
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ /dev/null
@@ -1,937 +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.Net.Sockets;
-using System.Reflection;
-using log4net;
-using Nwc.XmlRpc;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications;
-using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Region.Communications.Local;
-
-namespace OpenSim.Region.Communications.OGS1
-{
- public class OGS1GridServices : IGridServices
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- private bool m_useRemoteRegionCache = true;
- ///
- /// Encapsulate local backend services for manipulation of local regions
- ///
- private LocalBackEndServices m_localBackend = new LocalBackEndServices();
-
- private Dictionary m_remoteRegionInfoCache = new Dictionary();
- // private List m_knownRegions = new List();
- private Dictionary m_deadRegionCache = new Dictionary();
- private Dictionary m_queuedGridSettings = new Dictionary();
- private List m_regionsOnInstance = new List();
-
- public BaseHttpServer httpListener;
- public NetworkServersInfo serversInfo;
-
- public string gdebugRegionName
- {
- get { return m_localBackend.gdebugRegionName; }
- set { m_localBackend.gdebugRegionName = value; }
- }
-
- public string rdebugRegionName
- {
- get { return _rdebugRegionName; }
- set { _rdebugRegionName = value; }
- }
- private string _rdebugRegionName = String.Empty;
-
- public bool RegionLoginsEnabled
- {
- get { return m_localBackend.RegionLoginsEnabled; }
- set { m_localBackend.RegionLoginsEnabled = value; }
- }
-
- ///
- /// Contructor. Adds "expect_user" and "check" xmlrpc method handlers
- ///
- ///
- ///
- public OGS1GridServices(NetworkServersInfo servers_info)
- {
- serversInfo = servers_info;
-
- //Respond to Grid Services requests
- MainServer.Instance.AddXmlRPCHandler("check", PingCheckReply);
- }
-
- // see IGridServices
- public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
- {
- if (m_regionsOnInstance.Contains(regionInfo))
- {
- m_log.Error("[OGS1 GRID SERVICES]: Foobar! Caller is confused, region already registered " + regionInfo.RegionName);
- Exception e = new Exception(String.Format("Unable to register region"));
-
- throw e;
- }
-
- m_log.InfoFormat(
- "[OGS1 GRID SERVICES]: Registering region {0} with grid at {1}",
- regionInfo.RegionName, serversInfo.GridURL);
-
- m_regionsOnInstance.Add(regionInfo);
-
- Hashtable GridParams = new Hashtable();
- // Login / Authentication
-
- GridParams["authkey"] = serversInfo.GridSendKey;
- GridParams["recvkey"] = serversInfo.GridRecvKey;
- GridParams["UUID"] = regionInfo.RegionID.ToString();
- GridParams["sim_ip"] = regionInfo.ExternalHostName;
- GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();
- GridParams["region_locx"] = regionInfo.RegionLocX.ToString();
- GridParams["region_locy"] = regionInfo.RegionLocY.ToString();
- GridParams["sim_name"] = regionInfo.RegionName;
- GridParams["http_port"] = serversInfo.HttpListenerPort.ToString();
- GridParams["remoting_port"] = ConfigSettings.DefaultRegionRemotingPort.ToString();
- GridParams["map-image-id"] = regionInfo.RegionSettings.TerrainImageID.ToString();
- GridParams["originUUID"] = regionInfo.originRegionID.ToString();
- GridParams["server_uri"] = regionInfo.ServerURI;
- GridParams["region_secret"] = regionInfo.regionSecret;
- GridParams["major_interface_version"] = VersionInfo.MajorInterfaceVersion.ToString();
-
- if (regionInfo.MasterAvatarAssignedUUID != UUID.Zero)
- GridParams["master_avatar_uuid"] = regionInfo.MasterAvatarAssignedUUID.ToString();
- else
- GridParams["master_avatar_uuid"] = regionInfo.EstateSettings.EstateOwner.ToString();
-
- GridParams["maturity"] = regionInfo.RegionSettings.Maturity.ToString();
-
- // Package into an XMLRPC Request
- ArrayList SendParams = new ArrayList();
- SendParams.Add(GridParams);
-
- // Send Request
- XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
- XmlRpcResponse GridResp;
-
- try
- {
- // The timeout should always be significantly larger than the timeout for the grid server to request
- // the initial status of the region before confirming registration.
- GridResp = GridReq.Send(serversInfo.GridURL, 9999999);
- }
- catch (Exception e)
- {
- Exception e2
- = new Exception(
- String.Format(
- "Unable to register region with grid at {0}. Grid service not running?",
- serversInfo.GridURL),
- e);
-
- throw e2;
- }
-
- Hashtable GridRespData = (Hashtable)GridResp.Value;
- // Hashtable griddatahash = GridRespData;
-
- // Process Response
- if (GridRespData.ContainsKey("error"))
- {
- string errorstring = (string) GridRespData["error"];
-
- Exception e = new Exception(
- String.Format("Unable to connect to grid at {0}: {1}", serversInfo.GridURL, errorstring));
-
- throw e;
- }
- else
- {
- // m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
- if (GridRespData.ContainsKey("allow_forceful_banlines"))
- {
- if ((string) GridRespData["allow_forceful_banlines"] != "TRUE")
- {
- //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle);
- if (!m_queuedGridSettings.ContainsKey("allow_forceful_banlines"))
- m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
- }
- }
-
- m_log.InfoFormat(
- "[OGS1 GRID SERVICES]: Region {0} successfully registered with grid at {1}",
- regionInfo.RegionName, serversInfo.GridURL);
- }
-
- return m_localBackend.RegisterRegion(regionInfo);
- }
-
- // see IGridServices
- public bool DeregisterRegion(RegionInfo regionInfo)
- {
- Hashtable GridParams = new Hashtable();
-
- GridParams["UUID"] = regionInfo.RegionID.ToString();
-
- // Package into an XMLRPC Request
- ArrayList SendParams = new ArrayList();
- SendParams.Add(GridParams);
-
- // Send Request
- XmlRpcRequest GridReq = new XmlRpcRequest("simulator_after_region_moved", SendParams);
- XmlRpcResponse GridResp = null;
-
- try
- {
- GridResp = GridReq.Send(serversInfo.GridURL, 10000);
- }
- catch (Exception e)
- {
- Exception e2
- = new Exception(
- String.Format(
- "Unable to deregister region with grid at {0}. Grid service not running?",
- serversInfo.GridURL),
- e);
-
- throw e2;
- }
-
- Hashtable GridRespData = (Hashtable) GridResp.Value;
-
- // Hashtable griddatahash = GridRespData;
-
- // Process Response
- if (GridRespData != null && GridRespData.ContainsKey("error"))
- {
- string errorstring = (string)GridRespData["error"];
- m_log.Error("Unable to connect to grid: " + errorstring);
- return false;
- }
-
- return m_localBackend.DeregisterRegion(regionInfo);
- }
-
- public virtual Dictionary GetGridSettings()
- {
- Dictionary returnGridSettings = new Dictionary();
- lock (m_queuedGridSettings)
- {
- foreach (string Dictkey in m_queuedGridSettings.Keys)
- {
- returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
- }
-
- m_queuedGridSettings.Clear();
- }
-
- return returnGridSettings;
- }
-
- // see IGridServices
- public List RequestNeighbours(uint x, uint y)
- {
- Hashtable respData = MapBlockQuery((int) x - 1, (int) y - 1, (int) x + 1, (int) y + 1);
-
- List neighbours = new List();
-
- foreach (ArrayList neighboursList in respData.Values)
- {
- foreach (Hashtable neighbourData in neighboursList)
- {
- uint regX = Convert.ToUInt32(neighbourData["x"]);
- uint regY = Convert.ToUInt32(neighbourData["y"]);
- if ((x != regX) || (y != regY))
- {
- string simIp = (string) neighbourData["sim_ip"];
-
- uint port = Convert.ToUInt32(neighbourData["sim_port"]);
- // string externalUri = (string) neighbourData["sim_uri"];
-
- // string externalIpStr = String.Empty;
- try
- {
- // externalIpStr = Util.GetHostFromDNS(simIp).ToString();
- Util.GetHostFromDNS(simIp).ToString();
- }
- catch (SocketException e)
- {
- m_log.WarnFormat(
- "[OGS1 GRID SERVICES]: RequestNeighbours(): Lookup of neighbour {0} failed! Not including in neighbours list. {1}",
- simIp, e);
-
- continue;
- }
-
- SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
-
- sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
-
- if (neighbourData.ContainsKey("http_port"))
- {
- sri.HttpPort = Convert.ToUInt32(neighbourData["http_port"]);
- }
- else
- {
- m_log.Error("[OGS1 GRID SERVICES]: Couldn't find httpPort, using default 9000; please upgrade your grid-server to r7621 or later");
- sri.HttpPort = 9000; // that's the default and will probably be wrong
- }
-
- sri.RegionID = new UUID((string) neighbourData["uuid"]);
-
- neighbours.Add(sri);
- }
- }
- }
-
- return neighbours;
- }
-
- ///
- /// Request information about a region.
- ///
- ///
- ///
- /// null on a failure to contact or get a response from the grid server
- /// FIXME: Might be nicer to return a proper exception here since we could inform the client more about the
- /// nature of the faiulre.
- ///
- public RegionInfo RequestNeighbourInfo(UUID Region_UUID)
- {
- // don't ask the gridserver about regions on this instance...
- foreach (RegionInfo info in m_regionsOnInstance)
- {
- if (info.RegionID == Region_UUID) return info;
- }
-
- // didn't find it so far, we have to go the long way
- RegionInfo regionInfo;
- Hashtable requestData = new Hashtable();
- requestData["region_UUID"] = Region_UUID.ToString();
- requestData["authkey"] = serversInfo.GridSendKey;
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest gridReq = new XmlRpcRequest("simulator_data_request", SendParams);
- XmlRpcResponse gridResp = null;
-
- try
- {
- gridResp = gridReq.Send(serversInfo.GridURL, 3000);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat(
- "[OGS1 GRID SERVICES]: Communication with the grid server at {0} failed, {1}",
- serversInfo.GridURL, e);
-
- return null;
- }
-
- Hashtable responseData = (Hashtable)gridResp.Value;
-
- if (responseData.ContainsKey("error"))
- {
- m_log.WarnFormat("[OGS1 GRID SERVICES]: Error received from grid server: {0}", responseData["error"]);
- return null;
- }
-
- regionInfo = buildRegionInfo(responseData, String.Empty);
- if ((m_useRemoteRegionCache) && (requestData.ContainsKey("regionHandle")))
- {
- m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo);
- }
-
- return regionInfo;
- }
-
- ///
- /// Request information about a region.
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(ulong regionHandle)
- {
- RegionInfo regionInfo = m_localBackend.RequestNeighbourInfo(regionHandle);
-
- if (regionInfo != null)
- {
- return regionInfo;
- }
-
- if ((!m_useRemoteRegionCache) || (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)))
- {
- try
- {
- Hashtable requestData = new Hashtable();
- requestData["region_handle"] = regionHandle.ToString();
- requestData["authkey"] = serversInfo.GridSendKey;
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
- XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
-
- Hashtable responseData = (Hashtable) GridResp.Value;
-
- if (responseData.ContainsKey("error"))
- {
- m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server: " + responseData["error"]);
- return null;
- }
-
- uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
- uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
- string externalHostName = (string) responseData["sim_ip"];
- uint simPort = Convert.ToUInt32(responseData["sim_port"]);
- string regionName = (string)responseData["region_name"];
- UUID regionID = new UUID((string)responseData["region_UUID"]);
- uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
-
- uint httpPort = 9000;
- if (responseData.ContainsKey("http_port"))
- {
- httpPort = Convert.ToUInt32((string)responseData["http_port"]);
- }
-
- // Ok, so this is definitively the wrong place to do this, way too hard coded, but it doesn't seem we GET this info?
-
- string simURI = "http://" + externalHostName + ":" + simPort;
-
- // string externalUri = (string) responseData["sim_uri"];
-
- //IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
- regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, simURI);
-
- if (m_useRemoteRegionCache)
- {
- lock (m_remoteRegionInfoCache)
- {
- if (!m_remoteRegionInfoCache.ContainsKey(regionHandle))
- {
- m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
- }
- }
- }
- }
- catch (Exception e)
- {
- m_log.Error("[OGS1 GRID SERVICES]: " +
- "Region lookup failed for: " + regionHandle.ToString() +
- " - Is the GridServer down?" + e.ToString());
- return null;
- }
- }
-
- return regionInfo;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(string name)
- {
- // Not implemented yet
- return null;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(string host, uint port)
- {
- // Not implemented yet
- return null;
- }
-
- public RegionInfo RequestClosestRegion(string regionName)
- {
- if (m_useRemoteRegionCache)
- {
- foreach (RegionInfo ri in m_remoteRegionInfoCache.Values)
- {
- if (ri.RegionName == regionName)
- return ri;
- }
- }
-
- RegionInfo regionInfo = null;
- try
- {
- Hashtable requestData = new Hashtable();
- requestData["region_name_search"] = regionName;
- requestData["authkey"] = serversInfo.GridSendKey;
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
- XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
-
- Hashtable responseData = (Hashtable) GridResp.Value;
-
- if (responseData.ContainsKey("error"))
- {
- m_log.ErrorFormat("[OGS1 GRID SERVICES]: Error received from grid server: ", responseData["error"]);
- return null;
- }
-
- regionInfo = buildRegionInfo(responseData, "");
-
- if ((m_useRemoteRegionCache) && (!m_remoteRegionInfoCache.ContainsKey(regionInfo.RegionHandle)))
- m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo);
- }
- catch
- {
- m_log.Error("[OGS1 GRID SERVICES]: " +
- "Region lookup failed for: " + regionName +
- " - Is the GridServer down?");
- }
-
- return regionInfo;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
- {
- int temp = 0;
-
- if (minX > maxX)
- {
- temp = minX;
- minX = maxX;
- maxX = temp;
- }
- if (minY > maxY)
- {
- temp = minY;
- minY = maxY;
- maxY = temp;
- }
-
- Hashtable respData = MapBlockQuery(minX, minY, maxX, maxY);
-
- List neighbours = new List();
-
- foreach (ArrayList a in respData.Values)
- {
- foreach (Hashtable n in a)
- {
- MapBlockData neighbour = new MapBlockData();
-
- neighbour.X = Convert.ToUInt16(n["x"]);
- neighbour.Y = Convert.ToUInt16(n["y"]);
-
- neighbour.Name = (string) n["name"];
- neighbour.Access = Convert.ToByte(n["access"]);
- neighbour.RegionFlags = Convert.ToUInt32(n["region-flags"]);
- neighbour.WaterHeight = Convert.ToByte(n["water-height"]);
- neighbour.MapImageId = new UUID((string) n["map-image-id"]);
-
- neighbours.Add(neighbour);
- }
- }
-
- return neighbours;
- }
-
- ///
- /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
- ///
- /// REDUNDANT - OGS1 is to be phased out in favour of OGS2
- /// Minimum X value
- /// Minimum Y value
- /// Maximum X value
- /// Maximum Y value
- /// Hashtable of hashtables containing map data elements
- private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
- {
- Hashtable param = new Hashtable();
- param["xmin"] = minX;
- param["ymin"] = minY;
- param["xmax"] = maxX;
- param["ymax"] = maxY;
- IList parameters = new ArrayList();
- parameters.Add(param);
-
- try
- {
- XmlRpcRequest req = new XmlRpcRequest("map_block", parameters);
- XmlRpcResponse resp = req.Send(serversInfo.GridURL, 10000);
- Hashtable respData = (Hashtable) resp.Value;
- return respData;
- }
- catch (Exception e)
- {
- m_log.Error("MapBlockQuery XMLRPC failure: " + e);
- return new Hashtable();
- }
- }
-
- ///
- /// A ping / version check
- ///
- ///
- ///
- public XmlRpcResponse PingCheckReply(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- XmlRpcResponse response = new XmlRpcResponse();
-
- Hashtable respData = new Hashtable();
- respData["online"] = "true";
-
- m_localBackend.PingCheckReply(respData);
-
- response.Value = respData;
-
- return response;
- }
-
- ///
- /// Received from the user server when a user starts logging in. This call allows
- /// the region to prepare for direct communication from the client. Sends back an empty
- /// xmlrpc response on completion.
- ///
- ///
- ///
- public XmlRpcResponse ExpectUser(XmlRpcRequest request)
- {
- Hashtable requestData = (Hashtable) request.Params[0];
- AgentCircuitData agentData = new AgentCircuitData();
- agentData.SessionID = new UUID((string) requestData["session_id"]);
- agentData.SecureSessionID = new UUID((string) requestData["secure_session_id"]);
- agentData.firstname = (string) requestData["firstname"];
- agentData.lastname = (string) requestData["lastname"];
- agentData.AgentID = new UUID((string) requestData["agent_id"]);
- agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
- agentData.CapsPath = (string)requestData["caps_path"];
- ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
-
- // Appearance
- if (requestData["appearance"] != null)
- agentData.Appearance = new AvatarAppearance((Hashtable)requestData["appearance"]);
-
- m_log.DebugFormat(
- "[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
- agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
-
- if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
- {
- //m_log.Debug("[CLIENT]: Child agent detected");
- agentData.child = true;
- }
- else
- {
- //m_log.Debug("[CLIENT]: Main agent detected");
- agentData.startpos =
- new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
- (float)Convert.ToDecimal((string)requestData["startpos_y"]),
- (float)Convert.ToDecimal((string)requestData["startpos_z"]));
- agentData.child = false;
- }
-
- XmlRpcResponse resp = new XmlRpcResponse();
-
- if (!RegionLoginsEnabled)
- {
- m_log.InfoFormat(
- "[CLIENT]: Denying access for user {0} {1} because region login is currently disabled",
- agentData.firstname, agentData.lastname);
-
- Hashtable respdata = new Hashtable();
- respdata["success"] = "FALSE";
- respdata["reason"] = "region login currently disabled";
- resp.Value = respdata;
- }
- else
- {
- RegionInfo[] regions = m_regionsOnInstance.ToArray();
- bool banned = false;
-
- for (int i = 0; i < regions.Length; i++)
- {
- if (regions[i] != null)
- {
- if (regions[i].RegionHandle == regionHandle)
- {
- if (regions[i].EstateSettings.IsBanned(agentData.AgentID))
- {
- banned = true;
- break;
- }
- }
- }
- }
-
- if (banned)
- {
- m_log.InfoFormat(
- "[CLIENT]: Denying access for user {0} {1} because user is banned",
- agentData.firstname, agentData.lastname);
-
- Hashtable respdata = new Hashtable();
- respdata["success"] = "FALSE";
- respdata["reason"] = "banned";
- resp.Value = respdata;
- }
- else
- {
- m_localBackend.TriggerExpectUser(regionHandle, agentData);
- Hashtable respdata = new Hashtable();
- respdata["success"] = "TRUE";
- resp.Value = respdata;
- }
- }
-
- return resp;
- }
-
- // Grid Request Processing
- ///
- /// Ooops, our Agent must be dead if we're getting this request!
- ///
- ///
- ///
- public XmlRpcResponse LogOffUser(XmlRpcRequest request)
- {
- m_log.Debug("[CONNECTION DEBUGGING]: LogOff User Called");
-
- Hashtable requestData = (Hashtable)request.Params[0];
- string message = (string)requestData["message"];
- UUID agentID = UUID.Zero;
- UUID RegionSecret = UUID.Zero;
- UUID.TryParse((string)requestData["agent_id"], out agentID);
- UUID.TryParse((string)requestData["region_secret"], out RegionSecret);
-
- ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
-
- m_localBackend.TriggerLogOffUser(regionHandle, agentID, RegionSecret,message);
-
- return new XmlRpcResponse();
- }
-
- public void NoteDeadRegion(ulong regionhandle)
- {
- lock (m_deadRegionCache)
- {
- if (m_deadRegionCache.ContainsKey(regionhandle))
- {
- m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1;
- }
- else
- {
- m_deadRegionCache.Add(regionhandle, 1);
- }
- }
- }
-
- public LandData RequestLandData (ulong regionHandle, uint x, uint y)
- {
- m_log.DebugFormat("[OGS1 GRID SERVICES] requests land data in {0}, at {1}, {2}",
- regionHandle, x, y);
- LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
- if (landData == null)
- {
- Hashtable hash = new Hashtable();
- hash["region_handle"] = regionHandle.ToString();
- hash["x"] = x.ToString();
- hash["y"] = y.ToString();
-
- IList paramList = new ArrayList();
- paramList.Add(hash);
-
- try
- {
- // this might be cached, as we probably requested it just a moment ago...
- RegionInfo info = RequestNeighbourInfo(regionHandle);
- if (info != null) // just to be sure
- {
- XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
- string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
- XmlRpcResponse response = request.Send(uri, 10000);
- if (response.IsFault)
- {
- m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString);
- }
- else
- {
- hash = (Hashtable)response.Value;
- try
- {
- landData = new LandData();
- landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
- landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
- landData.Area = Convert.ToInt32(hash["Area"]);
- landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
- landData.Description = (string)hash["Description"];
- landData.Flags = Convert.ToUInt32(hash["Flags"]);
- landData.GlobalID = new UUID((string)hash["GlobalID"]);
- landData.Name = (string)hash["Name"];
- landData.OwnerID = new UUID((string)hash["OwnerID"]);
- landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
- landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
- landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
- m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
- }
- catch (Exception e)
- {
- m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e);
- }
- }
- }
- else m_log.WarnFormat("[OGS1 GRID SERVICES] Couldn't find region with handle {0}", regionHandle);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[OGS1 GRID SERVICES] Couldn't contact region {0}: {1}", regionHandle, e);
- }
- }
- return landData;
- }
-
- // Grid Request Processing
- ///
- /// Someone asked us about parcel-information
- ///
- ///
- ///
- public XmlRpcResponse LandData(XmlRpcRequest request, IPEndPoint remoteClient)
- {
- Hashtable requestData = (Hashtable)request.Params[0];
- ulong regionHandle = Convert.ToUInt64(requestData["region_handle"]);
- uint x = Convert.ToUInt32(requestData["x"]);
- uint y = Convert.ToUInt32(requestData["y"]);
- m_log.DebugFormat("[OGS1 GRID SERVICES]: Got XML reqeuest for land data at {0}, {1} in region {2}", x, y, regionHandle);
-
- LandData landData = m_localBackend.RequestLandData(regionHandle, x, y);
- Hashtable hash = new Hashtable();
- if (landData != null)
- {
- // for now, only push out the data we need for answering a ParcelInfoReqeust
- hash["AABBMax"] = landData.AABBMax.ToString();
- hash["AABBMin"] = landData.AABBMin.ToString();
- hash["Area"] = landData.Area.ToString();
- hash["AuctionID"] = landData.AuctionID.ToString();
- hash["Description"] = landData.Description;
- hash["Flags"] = landData.Flags.ToString();
- hash["GlobalID"] = landData.GlobalID.ToString();
- hash["Name"] = landData.Name;
- hash["OwnerID"] = landData.OwnerID.ToString();
- hash["SalePrice"] = landData.SalePrice.ToString();
- hash["SnapshotID"] = landData.SnapshotID.ToString();
- hash["UserLocation"] = landData.UserLocation.ToString();
- }
-
- XmlRpcResponse response = new XmlRpcResponse();
- response.Value = hash;
- return response;
- }
-
- public List RequestNamedRegions (string name, int maxNumber)
- {
- // no asking of the local backend first, here, as we have to ask the gridserver anyway.
- Hashtable hash = new Hashtable();
- hash["name"] = name;
- hash["maxNumber"] = maxNumber.ToString();
-
- IList paramList = new ArrayList();
- paramList.Add(hash);
-
- Hashtable result = XmlRpcSearchForRegionByName(paramList);
- if (result == null) return null;
-
- uint numberFound = Convert.ToUInt32(result["numFound"]);
- List infos = new List();
- for (int i = 0; i < numberFound; ++i)
- {
- string prefix = "region" + i + ".";
- RegionInfo info = buildRegionInfo(result, prefix);
- infos.Add(info);
- }
- return infos;
- }
-
- private RegionInfo buildRegionInfo(Hashtable responseData, string prefix)
- {
- uint regX = Convert.ToUInt32((string) responseData[prefix + "region_locx"]);
- uint regY = Convert.ToUInt32((string) responseData[prefix + "region_locy"]);
- string internalIpStr = (string) responseData[prefix + "sim_ip"];
- uint port = Convert.ToUInt32(responseData[prefix + "sim_port"]);
-
- IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(internalIpStr), (int) port);
-
- RegionInfo regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
- regionInfo.RemotingPort = Convert.ToUInt32((string) responseData[prefix + "remoting_port"]);
- regionInfo.RemotingAddress = internalIpStr;
-
- if (responseData.ContainsKey(prefix + "http_port"))
- {
- regionInfo.HttpPort = Convert.ToUInt32((string) responseData[prefix + "http_port"]);
- }
-
- regionInfo.RegionID = new UUID((string) responseData[prefix + "region_UUID"]);
- regionInfo.RegionName = (string) responseData[prefix + "region_name"];
-
- regionInfo.RegionSettings.TerrainImageID = new UUID((string) responseData[prefix + "map_UUID"]);
- return regionInfo;
- }
-
- private Hashtable XmlRpcSearchForRegionByName(IList parameters)
- {
- try
- {
- XmlRpcRequest request = new XmlRpcRequest("search_for_region_by_name", parameters);
- XmlRpcResponse resp = request.Send(serversInfo.GridURL, 10000);
- Hashtable respData = (Hashtable) resp.Value;
- if (respData != null && respData.Contains("faultCode"))
- {
- m_log.WarnFormat("[OGS1 GRID SERVICES]: Got an error while contacting GridServer: {0}", respData["faultString"]);
- return null;
- }
-
- return respData;
- }
- catch (Exception e)
- {
- m_log.Error("[OGS1 GRID SERVICES]: MapBlockQuery XMLRPC failure: ", e);
- return null;
- }
- }
- }
-}
--
cgit v1.1
From 68e40a87cafcab580ab484956f187068c098e84e Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sat, 26 Sep 2009 21:29:54 -0700
Subject: Poof! on LocalBackend. CommsManager.GridServices deleted.
---
.../Communications/Local/CommunicationsLocal.cs | 2 -
.../Communications/Local/LocalBackEndServices.cs | 410 ---------------------
2 files changed, 412 deletions(-)
delete mode 100644 OpenSim/Region/Communications/Local/LocalBackEndServices.cs
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index a658416..99bcea3 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -53,8 +53,6 @@ namespace OpenSim.Region.Communications.Local
m_avatarService = lus;
m_messageService = lus;
- m_gridService = new LocalBackEndServices();
-
//LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
}
}
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
deleted file mode 100644
index 0ab9374..0000000
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ /dev/null
@@ -1,410 +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.Reflection;
-using log4net;
-using OpenMetaverse;
-using OpenSim.Framework;
-using OpenSim.Framework.Communications;
-
-namespace OpenSim.Region.Communications.Local
-{
- public class LocalBackEndServices : IGridServices
- {
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
- protected Dictionary m_regions = new Dictionary();
-
- protected Dictionary m_regionListeners =
- new Dictionary();
-
- // private Dictionary m_remoteRegionInfoCache = new Dictionary();
-
- private Dictionary m_queuedGridSettings = new Dictionary();
-
- public string _gdebugRegionName = String.Empty;
-
- public bool RegionLoginsEnabled
- {
- get { return m_regionLoginsEnabled; }
- set { m_regionLoginsEnabled = value; }
- }
- private bool m_regionLoginsEnabled;
-
- public bool CheckRegion(string address, uint port)
- {
- return true;
- }
-
- public string gdebugRegionName
- {
- get { return _gdebugRegionName; }
- set { _gdebugRegionName = value; }
- }
-
- public string _rdebugRegionName = String.Empty;
-
- public string rdebugRegionName
- {
- get { return _rdebugRegionName; }
- set { _rdebugRegionName = value; }
- }
-
- ///
- /// Register a region method with the BackEnd Services.
- ///
- ///
- ///
- public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
- {
- //m_log.Debug("CommsManager - Region " + regionInfo.RegionHandle + " , " + regionInfo.RegionLocX + " , "+ regionInfo.RegionLocY +" is registering");
- if (!m_regions.ContainsKey(regionInfo.RegionHandle))
- {
- //m_log.Debug("CommsManager - Adding Region " + regionInfo.RegionHandle);
- m_regions.Add(regionInfo.RegionHandle, regionInfo);
-
- RegionCommsListener regionHost = new RegionCommsListener();
- if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
- {
- m_log.Error("[INTERREGION STANDALONE]: " +
- "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. " +
- "In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
- m_regionListeners.Remove(regionInfo.RegionHandle);
- }
- m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
-
- return regionHost;
- }
- else
- {
- // Already in our list, so the region went dead and restarted.
- // don't replace the old regioninfo.. this might be a locking issue.. however we need to
- // remove it and let it add normally below or we get extremely strange and intermittant
- // connectivity errors.
- // Don't change this line below to 'm_regions[regionInfo.RegionHandle] = regionInfo' unless you
- // *REALLY* know what you are doing here.
- m_regions[regionInfo.RegionHandle] = regionInfo;
-
- m_log.Warn("[INTERREGION STANDALONE]: Region registered twice. Region went down and came back up.");
-
- RegionCommsListener regionHost = new RegionCommsListener();
- if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
- {
- m_regionListeners.Remove(regionInfo.RegionHandle);
- }
- m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
-
- return regionHost;
- }
- }
-
- public bool DeregisterRegion(RegionInfo regionInfo)
- {
- if (m_regions.ContainsKey(regionInfo.RegionHandle))
- {
- m_regions.Remove(regionInfo.RegionHandle);
- if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
- {
- m_regionListeners.Remove(regionInfo.RegionHandle);
- }
- return true;
- }
- return false;
- }
-
- ///
- ///
- ///
- ///
- public List RequestNeighbours(uint x, uint y)
- {
- // m_log.Debug("Finding Neighbours to " + regionInfo.RegionHandle);
- List neighbours = new List();
-
- foreach (RegionInfo reg in m_regions.Values)
- {
- // m_log.Debug("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
- if (reg.RegionLocX != x || reg.RegionLocY != y)
- {
- //m_log.Debug("CommsManager- RequestNeighbours() - found a different region in list, checking location");
- if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
- {
- if ((reg.RegionLocY > (y - 2)) && (reg.RegionLocY < (y + 2)))
- {
- neighbours.Add(reg);
- }
- }
- }
- }
- return neighbours;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(ulong regionHandle)
- {
- if (m_regions.ContainsKey(regionHandle))
- {
- return m_regions[regionHandle];
- }
-
- return null;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(UUID regionID)
- {
- // TODO add a dictionary for faster lookup
- foreach (RegionInfo info in m_regions.Values)
- {
- if (info.RegionID == regionID)
- return info;
- }
-
- return null;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(string name)
- {
- foreach (RegionInfo info in m_regions.Values)
- {
- if (info.RegionName == name)
- return info;
- }
-
- return null;
- }
-
- ///
- /// Get information about a neighbouring region
- ///
- ///
- ///
- public RegionInfo RequestNeighbourInfo(string host, uint port)
- {
- foreach (RegionInfo info in m_regions.Values)
- {
- if ((info.ExternalHostName == host) && (info.HttpPort == port))
- return info;
- }
-
- return null;
- }
-
- ///
- /// Get information about the closet region given a region name.
- ///
- ///
- ///
- public RegionInfo RequestClosestRegion(string regionName)
- {
- foreach (RegionInfo regInfo in m_regions.Values)
- {
- if (regInfo.RegionName == regionName)
- return regInfo;
- }
- return null;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
- {
- List mapBlocks = new List();
- foreach (RegionInfo regInfo in m_regions.Values)
- {
- if (((regInfo.RegionLocX >= minX) && (regInfo.RegionLocX <= maxX)) &&
- ((regInfo.RegionLocY >= minY) && (regInfo.RegionLocY <= maxY)))
- {
- MapBlockData map = new MapBlockData();
- map.Name = regInfo.RegionName;
- map.X = (ushort) regInfo.RegionLocX;
- map.Y = (ushort) regInfo.RegionLocY;
- map.WaterHeight = (byte) regInfo.RegionSettings.WaterHeight;
- map.MapImageId = regInfo.RegionSettings.TerrainImageID;
- map.Agents = 1;
- map.RegionFlags = 72458694;
- map.Access = regInfo.AccessLevel;
- mapBlocks.Add(map);
- }
- }
- return mapBlocks;
- }
-
- // This function is only here to keep this class in line with the Grid Interface.
- // It never gets called.
- public virtual Dictionary GetGridSettings()
- {
- Dictionary returnGridSettings = new Dictionary();
- lock (m_queuedGridSettings)
- {
- returnGridSettings = m_queuedGridSettings;
- m_queuedGridSettings.Clear();
- }
-
- return returnGridSettings;
- }
-
- public virtual void SetForcefulBanlistsDisallowed()
- {
- m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
- }
-
-
- ///
- /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session
- ///
- ///
- ///
- ///
- public void AddNewSession(ulong regionHandle, Login loginData)
- {
- AgentCircuitData agent = new AgentCircuitData();
- agent.AgentID = loginData.Agent;
- agent.firstname = loginData.First;
- agent.lastname = loginData.Last;
- agent.SessionID = loginData.Session;
- agent.SecureSessionID = loginData.SecureSession;
- agent.circuitcode = loginData.CircuitCode;
- agent.BaseFolder = loginData.BaseFolder;
- agent.InventoryFolder = loginData.InventoryFolder;
- agent.startpos = loginData.StartPos;
- agent.CapsPath = loginData.CapsPath;
- if (loginData.Appearance != null)
- agent.Appearance = loginData.Appearance;
- else
- {
- m_log.WarnFormat("[INTER]: Appearance not found for {0} {1}. Creating default.", agent.firstname, agent.lastname);
- agent.Appearance = new AvatarAppearance(agent.AgentID);
- }
-
- TriggerExpectUser(regionHandle, agent);
- }
-
- public void TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
- {
- //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other region is sending child agent our way: " + agent.firstname + " " + agent.lastname);
-
- if (m_regionListeners.ContainsKey(regionHandle))
- {
- //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
-
- m_regionListeners[regionHandle].TriggerExpectUser(agent);
- }
- }
-
- public void TriggerLogOffUser(ulong regionHandle, UUID agentID, UUID RegionSecret, string message)
- {
- if (m_regionListeners.ContainsKey(regionHandle))
- {
- //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: FoundLocalRegion To send it to: " + agent.firstname + " " + agent.lastname);
-
- m_regionListeners[regionHandle].TriggerLogOffUser(agentID, RegionSecret, message);
- }
- }
-
- public void PingCheckReply(Hashtable respData)
- {
- foreach (ulong region in m_regions.Keys)
- {
- Hashtable regData = new Hashtable();
- RegionInfo reg = m_regions[region];
- regData["status"] = "active";
- regData["handle"] = region.ToString();
-
- respData[reg.RegionID.ToString()] = regData;
- }
- }
-
-
- public LandData RequestLandData (ulong regionHandle, uint x, uint y)
- {
- m_log.DebugFormat("[INTERREGION STANDALONE] requests land data in {0}, at {1}, {2}",
- regionHandle, x, y);
-
- if (m_regionListeners.ContainsKey(regionHandle))
- {
- LandData land = m_regionListeners[regionHandle].TriggerGetLandData(x, y);
- return land;
- }
-
- m_log.Debug("[INTERREGION STANDALONE] didn't find land data locally.");
- return null;
- }
-
- public List RequestNamedRegions (string name, int maxNumber)
- {
- List lowercase_regions = new List();
- List regions = new List();
- foreach (RegionInfo info in m_regions.Values)
- {
- // Prioritizes exact match
- if (info.RegionName.StartsWith(name))
- {
- regions.Add(info);
- if (regions.Count >= maxNumber) break;
- }
- // But still saves lower case matches
- else if (info.RegionName.ToLower().StartsWith(name))
- {
- if (lowercase_regions.Count < maxNumber)
- {
- lowercase_regions.Add(info);
- }
- }
- }
-
- // If no exact matches found, return lowercase matches (libOMV compatiblity)
- if (regions.Count == 0 && lowercase_regions.Count != 0)
- {
- return lowercase_regions;
- }
- return regions;
- }
- }
-}
--
cgit v1.1
From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 1 Oct 2009 01:00:09 +0900
Subject: Formatting cleanup.
---
.../Communications/Hypergrid/HGCommunicationsGridMode.cs | 4 ++--
.../Communications/Hypergrid/HGCommunicationsStandalone.cs | 8 ++++----
OpenSim/Region/Communications/Hypergrid/HGUserServices.cs | 2 +-
OpenSim/Region/Communications/Local/CommunicationsLocal.cs | 8 ++++----
OpenSim/Region/Communications/Local/LocalUserServices.cs | 4 ++--
OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | 2 +-
OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs | 6 +++---
OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | 10 +++++-----
8 files changed, 22 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
index 002ea17..e80f6ab 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs
@@ -50,11 +50,11 @@ namespace OpenSim.Region.Communications.Hypergrid
HGUserServices userServices = new HGUserServices(this);
// This plugin arrangement could eventually be configurable rather than hardcoded here.
userServices.AddPlugin(new TemporaryUserProfilePlugin());
- userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
+ userServices.AddPlugin(new HGUserDataPlugin(this, userServices));
m_userService = userServices;
m_messageService = userServices;
- m_avatarService = userServices;
+ m_avatarService = userServices;
}
}
}
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
index f5126ca..4e3f5a1 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs
@@ -41,13 +41,13 @@ namespace OpenSim.Region.Communications.Hypergrid
public class HGCommunicationsStandalone : CommunicationsManager
{
public HGCommunicationsStandalone(
- ConfigSettings configSettings,
+ ConfigSettings configSettings,
NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
LibraryRootFolder libraryRootFolder,
bool dumpAssetsToFile)
: base(serversInfo, libraryRootFolder)
- {
+ {
LocalUserServices localUserService =
new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
@@ -58,8 +58,8 @@ namespace OpenSim.Region.Communications.Hypergrid
hgUserService.AddPlugin(new TemporaryUserProfilePlugin());
hgUserService.AddPlugin(new HGUserDataPlugin(this, hgUserService));
- m_userService = hgUserService;
- m_userAdminService = hgUserService;
+ m_userService = hgUserService;
+ m_userAdminService = hgUserService;
m_avatarService = hgUserService;
m_messageService = hgUserService;
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
index f1a56ef..49a2261 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Communications.Hypergrid
return m_localUserServices.AddUserAgent(agentdata);
return base.AddUserAgent(agentdata);
- }
+ }
public override UserAgentData GetAgentByUUID(UUID userId)
{
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 99bcea3..eaf996d 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Region.Communications.Local
public class CommunicationsLocal : CommunicationsManager
{
public CommunicationsLocal(
- ConfigSettings configSettings,
+ ConfigSettings configSettings,
NetworkServersInfo serversInfo,
LibraryRootFolder libraryRootFolder)
: base(serversInfo, libraryRootFolder)
@@ -47,13 +47,13 @@ namespace OpenSim.Region.Communications.Local
= new LocalUserServices(
serversInfo.DefaultHomeLocX, serversInfo.DefaultHomeLocY, this);
lus.AddPlugin(new TemporaryUserProfilePlugin());
- lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
+ lus.AddPlugin(configSettings.StandaloneUserPlugin, configSettings.StandaloneUserSource);
m_userService = lus;
- m_userAdminService = lus;
+ m_userAdminService = lus;
m_avatarService = lus;
m_messageService = lus;
- //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
+ //LocalLoginService loginService = CreateLoginService(libraryRootFolder, inventoryService, userService, backendService);
}
}
}
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index d18937e..89b55c4 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.Local
if (md5PasswordHash == userProfile.PasswordHash)
return true;
else
- return false;
- }
+ return false;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
index c2b8f26..94e4ed2 100644
--- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
+++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.Communications.OGS1
: base(serversInfo, libraryRootFolder)
{
- // This plugin arrangement could eventually be configurable rather than hardcoded here.
+ // This plugin arrangement could eventually be configurable rather than hardcoded here.
OGS1UserServices userServices = new OGS1UserServices(this);
userServices.AddPlugin(new TemporaryUserProfilePlugin());
userServices.AddPlugin(new OGS1UserDataPlugin(this));
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
index 01d6ec8..2f9a45f 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserDataPlugin.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Communications.OGS1
public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{
// Not interested
- }
+ }
public UserProfileData GetUserByUri(Uri uri)
{
@@ -695,7 +695,7 @@ namespace OpenSim.Region.Communications.OGS1
userData.Partner = UUID.Zero;
return userData;
- }
+ }
protected AvatarAppearance ConvertXMLRPCDataToAvatarAppearance(Hashtable data)
{
@@ -766,6 +766,6 @@ namespace OpenSim.Region.Communications.OGS1
}
return buddylist;
- }
+ }
}
}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index 51ba2e9..ed3526d 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -41,7 +41,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Clients;
namespace OpenSim.Region.Communications.OGS1
-{
+{
public class OGS1UserServices : UserManagerBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
catch (WebException)
{
m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff");
- }
+ }
}
///
@@ -150,10 +150,10 @@ namespace OpenSim.Region.Communications.OGS1
IList parameters = new ArrayList();
parameters.Add(param);
XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters);
- XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
+ XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000);
// Temporary measure to deal with older services
- if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD)
+ if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD)
{
throw new Exception(
String.Format(
@@ -170,7 +170,7 @@ namespace OpenSim.Region.Communications.OGS1
else
{
return false;
- }
+ }
}
}
}
\ No newline at end of file
--
cgit v1.1