From ef5575be1b7e8122883773c799ddc522ed80c156 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Tue, 17 Jan 2012 21:09:46 -0500
Subject: Add json handler for GridInfo
---
OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 15 +++++++++++++++
OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs | 2 ++
2 files changed, 17 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
index 645a77f..bfcddca 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
@@ -37,6 +37,7 @@ using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
+using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Handlers.Grid
{
@@ -142,5 +143,19 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString();
}
+
+ public string JsonGetGridInfoMethod(string request, string path, string param,
+ IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
+ {
+
+ OSDMap map = new OSDMap();
+
+ foreach (string k in _info.Keys)
+ {
+ map[k] = OSD.FromString(_info[k].ToString());
+ }
+
+ return OSDParser.SerializeJsonString(map).ToString();
+ }
}
}
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs
index 8472d34..f9b5915 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoServerInConnector.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Server.Handlers.Grid
server.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
handlers.RestGetGridInfoMethod));
+ server.AddStreamHandler(new RestStreamHandler("GET", "/json_grid_info",
+ handlers.JsonGetGridInfoMethod));
server.AddXmlRPCHandler("get_grid_info", handlers.XmlRpcGridInfoMethod);
}
--
cgit v1.1
From 9ed9720861ef3b63b1fca75c843a509ee3239b17 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Tue, 17 Jan 2012 22:07:40 -0500
Subject: Update osGetGrid**** functions
The osGetGrid**** functions will now get the grid settings from the GridInfoService. Set the GridInfoURI in your ./bin/config-include/GridCommon.ini [GridInfo] section.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 72 +++++++++++++++++++++-
1 file changed, 69 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index fc478ab..c7a62b3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1944,6 +1944,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ private enum InfoType
+ {
+ Nick,
+ Name,
+ Login
+ };
+
+ private string GridUserInfo(InfoType type)
+ {
+ string retval = String.Empty;
+ IConfigSource config = m_ScriptEngine.ConfigSource;
+ string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty);
+
+ if (String.IsNullOrEmpty(url))
+ return "Configuration Error!";
+
+ string verb ="/json_grid_info";
+ OSDMap json = new OSDMap();
+
+ OSDMap info = WebUtil.GetFromService(String.Format("{0}{1}",url,verb), 3000);
+
+ if (info["Success"] != true)
+ return "Get GridInfo Failed!";
+
+ json = (OSDMap)OSDParser.DeserializeJson(info["_RawResult"].AsString());
+
+ switch (type)
+ {
+ case InfoType.Nick:
+ retval = json["gridnick"];
+ break;
+
+ case InfoType.Name:
+ retval = json["gridname"];
+ break;
+
+ case InfoType.Login:
+ retval = json["login"];
+ break;
+
+ default:
+ retval = "error";
+ break;
+ }
+
+ return retval;
+ }
+
///
/// Get the nickname of this grid, as set in the [GridInfo] config section.
///
@@ -1957,10 +2005,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick");
m_host.AddScriptLPS(1);
- string nick = "hippogrid";
+
+ string nick = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
+
if (config.Configs["GridInfo"] != null)
nick = config.Configs["GridInfo"].GetString("gridnick", nick);
+
+ if (String.IsNullOrEmpty(nick))
+ nick = GridUserInfo(InfoType.Nick);
+
return nick;
}
@@ -1968,10 +2022,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName");
m_host.AddScriptLPS(1);
- string name = "the lost continent of hippo";
+
+ string name = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
+
if (config.Configs["GridInfo"] != null)
name = config.Configs["GridInfo"].GetString("gridname", name);
+
+ if (String.IsNullOrEmpty(name))
+ name = GridUserInfo(InfoType.Name);
+
return name;
}
@@ -1979,10 +2039,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI");
m_host.AddScriptLPS(1);
- string loginURI = "http://127.0.0.1:9000/";
+
+ string loginURI = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
+
if (config.Configs["GridInfo"] != null)
loginURI = config.Configs["GridInfo"].GetString("login", loginURI);
+
+ if (String.IsNullOrEmpty(loginURI))
+ loginURI = GridUserInfo(InfoType.Login);
+
return loginURI;
}
--
cgit v1.1
From ba7d8cedeca1440fe4d4166308fec56fbbcdac19 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Tue, 17 Jan 2012 22:38:36 -0500
Subject: Add function osGetGridCustom
Add function osGetGridCustom to take an argument for the GridInfo kpv to retrieve from the GridInfoService
---
.../Shared/Api/Implementation/OSSL_Api.cs | 29 +++++++++++++++++++++-
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 ++++
3 files changed, 34 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c7a62b3..c682fda 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1948,11 +1948,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
Nick,
Name,
- Login
+ Login,
+ Custom
};
private string GridUserInfo(InfoType type)
{
+ return GridUserInfo(type, "");
+ }
+
+ private string GridUserInfo(InfoType type, string key)
+ {
string retval = String.Empty;
IConfigSource config = m_ScriptEngine.ConfigSource;
string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty);
@@ -1984,6 +1990,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
retval = json["login"];
break;
+ case InfoType.Custom:
+ retval = json[key];
+ break;
+
default:
retval = "error";
break;
@@ -2052,6 +2062,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return loginURI;
}
+ public string osGetGridCustom(string key)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");
+ m_host.AddScriptLPS(1);
+
+ string retval = String.Empty;
+ IConfigSource config = m_ScriptEngine.ConfigSource;
+
+ if (config.Configs["GridInfo"] != null)
+ retval = config.Configs["GridInfo"].GetString(key, retval);
+
+ if (String.IsNullOrEmpty(retval))
+ retval = GridUserInfo(InfoType.Custom, key);
+
+ return retval;
+ }
+
public LSL_String osFormatString(string str, LSL_List strings)
{
CheckThreatLevel(ThreatLevel.Low, "osFormatString");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index af6be5f..c1c4511 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -160,6 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetGridNick();
string osGetGridName();
string osGetGridLoginURI();
+ string osGetGridCustom(string key);
LSL_String osFormatString(string str, LSL_List strings);
LSL_List osMatchString(string src, string pattern, int start);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 0c05ea4..fc83786 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -452,6 +452,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetGridLoginURI();
}
+ public string osGetGridCustom(string key)
+ {
+ return m_OSSL_Functions.osGetGridCustom(key);
+ }
+
public LSL_String osFormatString(string str, LSL_List strings)
{
return m_OSSL_Functions.osFormatString(str, strings);
--
cgit v1.1
From eea726d74ecafb9383d2ae7ec257d1fc5b6782b0 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Wed, 18 Jan 2012 20:30:57 -0500
Subject: RegionReady:
Back out some of the oar monitoring for the time being. Need to find a better way to get feedback. Will re-visit this soon.
---
OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 2 ++
.../Scripting/RegionReadyModule/RegionReadyModule.cs | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index a945fc2..0b22598 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -100,12 +100,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; });
// Send a message to the region ready module
+ /* bluewall* Disable this for the time being
IRegionReadyModule rready = m_scene.RequestModuleInterface();
if (rready != null)
{
rready.OarLoadingAlert("load");
}
+ */
List mainParams = options.Parse(cmdparams);
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index feef49b..d2810be 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -243,6 +243,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
public void OarLoadingAlert(string msg)
{
+ // Let's bypass this for now until some better feedback can be established
+ //
+ return;
+
if (msg == "load")
{
m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
@@ -251,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_scene.EventManager.OnRezScript += OnRezScript;
m_oarFileLoading = true;
m_firstEmptyCompileQueue = true;
- // Will need some controls around this
+
m_scene.LoginsDisabled = true;
m_scene.LoginLock = true;
if ( m_uri != string.Empty )
--
cgit v1.1
From bf9ce4709faa22c23411ade380e77a699a29ce51 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 19 Jan 2012 13:48:31 -0500
Subject: Add fetching of SRV_HomeURI to "/json_grid_info"
Make SRV_HomeURI available on the GridInfoService through the "/json_grid_info" URI. This i s mainly to service OSSL, but can be seen externally via the URI.
---
OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 37 +++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
index bfcddca..67472e3 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Grid
public class GridInfoHandlers
{
private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
-
+ private IConfigSource m_Config;
private Hashtable _info = new Hashtable();
///
@@ -60,6 +60,7 @@ namespace OpenSim.Server.Handlers.Grid
///
public GridInfoHandlers(IConfigSource configSource)
{
+ m_Config = configSource;
loadGridInfo(configSource);
}
@@ -144,9 +145,38 @@ namespace OpenSim.Server.Handlers.Grid
return sb.ToString();
}
+ ///
+ /// Get GridInfo in json format: Used bu the OSSL osGetGrid*
+ /// Adding the SRV_HomeIRI to the kvp returned for use in scripts
+ ///
+ ///
+ /// json string
+ ///
+ ///
+ /// Request.
+ ///
+ ///
+ /// /json_grid_info
+ ///
+ ///
+ /// Parameter.
+ ///
+ ///
+ /// Http request.
+ ///
+ ///
+ /// Http response.
+ ///
public string JsonGetGridInfoMethod(string request, string path, string param,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
+ string HomeURI = String.Empty;
+ IConfig cfg = m_Config.Configs["LoginService"];
+
+ if (null != cfg)
+ {
+ HomeURI = cfg.GetString("SRV_HomeURI", HomeURI);
+ }
OSDMap map = new OSDMap();
@@ -155,6 +185,11 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString());
}
+ if (!String.IsNullOrEmpty(HomeURI))
+ {
+ map["HomeURI"] = OSD.FromString(HomeURI);
+ }
+
return OSDParser.SerializeJsonString(map).ToString();
}
}
--
cgit v1.1
From edb2e4c5b3d5ed5d75edf1b6efbfd8bffe427e13 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 19 Jan 2012 13:55:53 -0500
Subject: Change URI to lowercase to match existing
---
OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
index 67472e3..965a54e 100644
--- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
+++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs
@@ -187,7 +187,7 @@ namespace OpenSim.Server.Handlers.Grid
if (!String.IsNullOrEmpty(HomeURI))
{
- map["HomeURI"] = OSD.FromString(HomeURI);
+ map["home"] = OSD.FromString(HomeURI);
}
return OSDParser.SerializeJsonString(map).ToString();
--
cgit v1.1
From 9356963bd36e5c3b8c2b27bfcc2efa60ffbd02d6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 19:00:11 +0000
Subject: Add basic request and send image regression tests for LLImageManager
---
OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 6 +-
.../ClientStack/Linden/UDP/LLImageManager.cs | 6 +-
.../Linden/UDP/Tests/LLImageManagerTests.cs | 92 +++++++++++++++++++++
.../Linden/UDP/Tests/Resources/4-tile2.jp2 | Bin 0 -> 24410 bytes
.../World/Archiver/Tests/ArchiverTests.cs | 2 +-
OpenSim/Tests/Common/Mock/TestClient.cs | 13 +--
6 files changed, 107 insertions(+), 12 deletions(-)
create mode 100644 OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
create mode 100644 OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 185a909..bbd2c43 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Maximum number of packets to send during this call
/// Number of packets sent during this call
/// True if the transfer completes at the current discard level, otherwise false
- public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent)
+ public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent)
{
packetsSent = 0;
@@ -212,7 +212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
- private bool SendFirstPacket(LLClientView client)
+ private bool SendFirstPacket(IClientAPI client)
{
if (client == null)
return false;
@@ -247,7 +247,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return false;
}
- private bool SendPacket(LLClientView client)
+ private bool SendPacket(IClientAPI client)
{
if (client == null)
return false;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index db428f1..30d3712 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -55,16 +55,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_shuttingdown;
private AssetBase m_missingImage;
- private LLClientView m_client; //Client we're assigned to
+ private IClientAPI m_client; //Client we're assigned to
private IAssetService m_assetCache; //Asset Cache
private IJ2KDecoder m_j2kDecodeModule; //Our J2K module
private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer());
private object m_syncRoot = new object();
- public LLClientView Client { get { return m_client; } }
+ public IClientAPI Client { get { return m_client; } }
public AssetBase MissingImage { get { return m_missingImage; } }
- public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
+ public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
{
m_client = client;
m_assetCache = pAssetCache;
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
new file mode 100644
index 0000000..bdc9c7d
--- /dev/null
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -0,0 +1,92 @@
+/*
+ * 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.IO;
+using System.Net;
+using System.Reflection;
+using log4net.Config;
+using Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenMetaverse.Packets;
+using OpenSim.Framework;
+using OpenSim.Region.CoreModules.Agent.TextureSender;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+
+namespace OpenSim.Region.ClientStack.LindenUDP.Tests
+{
+ [TestFixture]
+ public class LLImageManagerTests
+ {
+ [Test]
+ public void TestRequestAndSendImage()
+ {
+ TestHelpers.InMethod();
+// XmlConfigurator.Configure();
+
+ UUID imageId = TestHelpers.ParseTail(0x1);
+ string creatorId = TestHelpers.ParseTail(0x2).ToString();
+ UUID userId = TestHelpers.ParseTail(0x3);
+
+ J2KDecoderModule j2kdm = new J2KDecoderModule();
+
+ Scene scene = SceneHelpers.SetupScene();
+ SceneHelpers.SetupSceneModules(scene, j2kdm);
+
+ TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
+ LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
+
+ using (
+ Stream resource
+ = GetType().Assembly.GetManifestResourceStream(
+ "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
+ {
+ using (BinaryReader br = new BinaryReader(resource))
+ {
+ AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
+ asset.Data = br.ReadBytes(99999999);
+ scene.AssetService.Store(asset);
+ }
+ }
+
+ TextureRequestArgs args = new TextureRequestArgs();
+ args.RequestedAssetID = TestHelpers.ParseTail(0x1);
+ args.DiscardLevel = 0;
+ args.PacketNumber = 1;
+ args.Priority = 5;
+ args.requestSequence = 1;
+
+ llim.EnqueueReq(args);
+ llim.ProcessImageQueue(20);
+
+ Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 b/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2
new file mode 100644
index 0000000..8c63104
Binary files /dev/null and b/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 differ
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index e798e5e..eec3c1b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -344,7 +344,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{
using (BinaryReader br = new BinaryReader(resource))
{
- // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion
+ // FIXME: Use the inspector instead
soundData = br.ReadBytes(99999999);
UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
string soundAssetFileName
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 37b90e1..2fc6572 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -44,9 +44,6 @@ namespace OpenSim.Tests.Common.Mock
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- // Mock testing variables
- public List sentdatapkt = new List();
- public List sentpktpkt = new List();
EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
// TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
@@ -61,6 +58,9 @@ namespace OpenSim.Tests.Common.Mock
public List ReceivedOnlineNotifications { get; private set; }
public List ReceivedFriendshipTerminations { get; private set; }
+ public List SentImageDataPackets { get; private set; }
+ public List SentImagePacketPackets { get; private set; }
+
// disable warning: public events, part of the public API
#pragma warning disable 67
@@ -452,6 +452,9 @@ namespace OpenSim.Tests.Common.Mock
ReceivedOfflineNotifications = new List();
ReceivedOnlineNotifications = new List();
ReceivedFriendshipTerminations = new List();
+
+ SentImageDataPackets = new List();
+ SentImagePacketPackets = new List();
}
///
@@ -804,7 +807,7 @@ namespace OpenSim.Tests.Common.Mock
im.ImageData.Data = ImageData;
im.ImageID.Codec = imageCodec;
im.Header.Zerocoded = true;
- sentdatapkt.Add(im);
+ SentImageDataPackets.Add(im);
}
public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
@@ -814,7 +817,7 @@ namespace OpenSim.Tests.Common.Mock
im.ImageID.Packet = partNumber;
im.ImageID.ID = imageUuid;
im.ImageData.Data = imageData;
- sentpktpkt.Add(im);
+ SentImagePacketPackets.Add(im);
}
public void SendImageNotFound(UUID imageid)
--
cgit v1.1
From 8f871cca10274325bf90054d75019a865fc50216 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 19 Jan 2012 14:21:12 -0500
Subject: Add osGetGridHomeURI function
Add osGetHomeURI function to the family of osGetGrid* functions. Returns the SRV_HomeURI setting from the [LoginService] configuration.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 22 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++
3 files changed, 28 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c682fda..7792ab5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1949,6 +1949,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Nick,
Name,
Login,
+ Home,
Custom
};
@@ -1990,6 +1991,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
retval = json["login"];
break;
+ case InfoType.Home:
+ retval = json["home"];
+ break;
+
case InfoType.Custom:
retval = json[key];
break;
@@ -2062,6 +2067,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return loginURI;
}
+ public string osGetGridHomeURI()
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI");
+ m_host.AddScriptLPS(1);
+
+ string HomeURI = String.Empty;
+ IConfigSource config = m_ScriptEngine.ConfigSource;
+
+ if (config.Configs["LoginService"] != null)
+ HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI);
+
+ if (String.IsNullOrEmpty(HomeURI))
+ HomeURI = GridUserInfo(InfoType.Home);
+
+ return HomeURI;
+ }
+
public string osGetGridCustom(string key)
{
CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index c1c4511..0f8cbdc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -160,6 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetGridNick();
string osGetGridName();
string osGetGridLoginURI();
+ string osGetGridHomeURI();
string osGetGridCustom(string key);
LSL_String osFormatString(string str, LSL_List strings);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index fc83786..02efecf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -452,6 +452,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_OSSL_Functions.osGetGridLoginURI();
}
+ public string osGetGridHomeURI()
+ {
+ return m_OSSL_Functions.osGetGridHomeURI();
+ }
+
public string osGetGridCustom(string key)
{
return m_OSSL_Functions.osGetGridCustom(key);
--
cgit v1.1
From c92a9a664035ad4c36a0ac905751d105770dca51 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 19:49:06 +0000
Subject: Add "image queues clear " console command
This allows a way to manually clear pending image queue requests for debug purposes
---
.../ClientStack/Linden/UDP/LLImageManager.cs | 20 ++++++
.../Agent/UDP/Linden/LindenUDPInfoModule.cs | 75 +++++++++++++++++-----
2 files changed, 80 insertions(+), 15 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 30d3712..7bfb844 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -246,6 +246,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
///
+ /// Clear the image queue.
+ ///
+ /// The number of requests cleared.
+ public int ClearImageQueue()
+ {
+ int requestsDeleted;
+
+ lock (m_priorityQueue)
+ {
+ requestsDeleted = m_priorityQueue.Count;
+
+ // Surprisingly, there doesn't seem to be a clear method at this time.
+ while (!m_priorityQueue.IsEmpty)
+ m_priorityQueue.DeleteMax();
+ }
+
+ return requestsDeleted;
+ }
+
+ ///
/// Returns an array containing all the images in the queue.
///
///
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index db70e56..95aa864 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -79,7 +79,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
lock (m_scenes)
- m_scenes[scene.RegionInfo.RegionID] = scene;
+ m_scenes[scene.RegionInfo.RegionID] = scene;
+
+ scene.AddCommand(
+ this, "image queues clear",
+ "image queues clear ",
+ "Clear the image queues (textures downloaded via UDP) for a particular client.",
+ (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
+
+ scene.AddCommand(
+ this, "show image queues",
+ "image queues show ",
+ "Show the image queues (textures downloaded via UDP) for a particular client.",
+ (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
scene.AddCommand(
this, "show pqueues",
@@ -116,7 +128,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"emergency-monitoring",
"Go on/off emergency monitoring mode",
"Go on/off emergency monitoring mode",
- EmergencyMonitoring);
+ HandleEmergencyMonitoring);
}
public void RemoveRegion(Scene scene)
@@ -132,7 +144,49 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
- protected void EmergencyMonitoring(string module, string[] cmd)
+ protected string HandleImageQueuesClear(string[] cmd)
+ {
+ if (cmd.Length != 5)
+ return "Usage: image queues clear ";
+
+ string firstName = cmd[3];
+ string lastName = cmd[4];
+
+ List foundAgents = new List();
+
+ lock (m_scenes)
+ {
+ foreach (Scene scene in m_scenes.Values)
+ {
+ ScenePresence sp = scene.GetScenePresence(firstName, lastName);
+ if (sp != null)
+ foundAgents.Add(sp);
+ }
+ }
+
+ if (foundAgents.Count == 0)
+ return string.Format("No agents found for {0} {1}", firstName, lastName);
+
+ StringBuilder report = new StringBuilder();
+
+ foreach (ScenePresence agent in foundAgents)
+ {
+ LLClientView client = agent.ControllingClient as LLClientView;
+
+ if (client == null)
+ return "This command is only supported for LLClientView";
+
+ int requestsDeleted = client.ImageManager.ClearImageQueue();
+
+ report.AppendFormat(
+ "In region {0} ({1} agent) cleared {2} requests\n",
+ agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted);
+ }
+
+ return report.ToString();
+ }
+
+ protected void HandleEmergencyMonitoring(string module, string[] cmd)
{
bool mode = true;
if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
@@ -239,10 +293,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
private string GetImageQueuesReport(string[] showParams)
{
if (showParams.Length < 5 || showParams.Length > 6)
- {
- MainConsole.Instance.OutputFormat("Usage: show image queues [full]");
- return "";
- }
+ return "Usage: show image queues [full]";
string firstName = showParams[3];
string lastName = showParams[4];
@@ -262,10 +313,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
}
if (foundAgents.Count == 0)
- {
- MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName);
- return "";
- }
+ return string.Format("No agents found for {0} {1}", firstName, lastName);
StringBuilder report = new StringBuilder();
@@ -274,10 +322,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
LLClientView client = agent.ControllingClient as LLClientView;
if (client == null)
- {
- MainConsole.Instance.OutputFormat("This command is only supported for LLClientView");
- return "";
- }
+ return "This command is only supported for LLClientView";
J2KImage[] images = client.ImageManager.GetImages();
--
cgit v1.1
From 381f74276b94f9f635b08c4bccf3040fce5d59fb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 21:14:09 +0000
Subject: Add LLImageManager regression test for discard case
---
.../Linden/UDP/Tests/LLImageManagerTests.cs | 53 ++++++++++++++++++++++
1 file changed, 53 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index bdc9c7d..118333c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -88,5 +88,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1));
}
+
+ [Test]
+ public void TestRequestAndDiscardImage()
+ {
+ TestHelpers.InMethod();
+// XmlConfigurator.Configure();
+
+ UUID imageId = TestHelpers.ParseTail(0x1);
+ string creatorId = TestHelpers.ParseTail(0x2).ToString();
+ UUID userId = TestHelpers.ParseTail(0x3);
+
+ J2KDecoderModule j2kdm = new J2KDecoderModule();
+
+ Scene scene = SceneHelpers.SetupScene();
+ SceneHelpers.SetupSceneModules(scene, j2kdm);
+
+ TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
+ LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
+
+ using (
+ Stream resource
+ = GetType().Assembly.GetManifestResourceStream(
+ "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
+ {
+ using (BinaryReader br = new BinaryReader(resource))
+ {
+ AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
+ asset.Data = br.ReadBytes(99999999);
+ scene.AssetService.Store(asset);
+ }
+ }
+
+ TextureRequestArgs args = new TextureRequestArgs();
+ args.RequestedAssetID = imageId;
+ args.DiscardLevel = 0;
+ args.PacketNumber = 1;
+ args.Priority = 5;
+ args.requestSequence = 1;
+ llim.EnqueueReq(args);
+
+ // Now create a discard request
+ TextureRequestArgs discardArgs = new TextureRequestArgs();
+ discardArgs.RequestedAssetID = imageId;
+ discardArgs.DiscardLevel = -1;
+ discardArgs.PacketNumber = 1;
+ discardArgs.Priority = 0;
+ discardArgs.requestSequence = 2;
+ llim.EnqueueReq(discardArgs);
+
+ llim.ProcessImageQueue(20);
+
+ Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 503faaea62502e1e86fc11bee1a322e060836f62 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 21:23:40 +0000
Subject: refactor: separate out common parts of LLImageManagerTests
---
.../Linden/UDP/Tests/LLImageManagerTests.cs | 88 ++++++++++------------
1 file changed, 40 insertions(+), 48 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index 118333c..f176964 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -45,24 +45,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
[TestFixture]
public class LLImageManagerTests
{
- [Test]
- public void TestRequestAndSendImage()
- {
- TestHelpers.InMethod();
-// XmlConfigurator.Configure();
-
- UUID imageId = TestHelpers.ParseTail(0x1);
- string creatorId = TestHelpers.ParseTail(0x2).ToString();
- UUID userId = TestHelpers.ParseTail(0x3);
-
- J2KDecoderModule j2kdm = new J2KDecoderModule();
-
- Scene scene = SceneHelpers.SetupScene();
- SceneHelpers.SetupSceneModules(scene, j2kdm);
-
- TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
- LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
+ private AssetBase m_testImageAsset;
+ private LLImageManager llim;
+ private TestClient tc;
+ [TestFixtureSetUp]
+ public void FixtureInit()
+ {
using (
Stream resource
= GetType().Assembly.GetManifestResourceStream(
@@ -70,14 +59,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
{
using (BinaryReader br = new BinaryReader(resource))
{
- AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
- asset.Data = br.ReadBytes(99999999);
- scene.AssetService.Store(asset);
+ m_testImageAsset
+ = new AssetBase(
+ TestHelpers.ParseTail(0x1),
+ "Test Image",
+ (sbyte)AssetType.Texture,
+ TestHelpers.ParseTail(0x2).ToString());
+
+ m_testImageAsset.Data = br.ReadBytes(99999999);
}
}
+ }
+
+ [SetUp]
+ public void SetUp()
+ {
+ UUID userId = TestHelpers.ParseTail(0x3);
+
+ J2KDecoderModule j2kdm = new J2KDecoderModule();
+
+ Scene scene = SceneHelpers.SetupScene();
+ SceneHelpers.SetupSceneModules(scene, j2kdm);
+
+ scene.AssetService.Store(m_testImageAsset);
+
+ tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
+ llim = new LLImageManager(tc, scene.AssetService, j2kdm);
+ }
+
+ [Test]
+ public void TestRequestAndSendImage()
+ {
+ TestHelpers.InMethod();
+// XmlConfigurator.Configure();
TextureRequestArgs args = new TextureRequestArgs();
- args.RequestedAssetID = TestHelpers.ParseTail(0x1);
+ args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
@@ -95,33 +112,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
TestHelpers.InMethod();
// XmlConfigurator.Configure();
- UUID imageId = TestHelpers.ParseTail(0x1);
- string creatorId = TestHelpers.ParseTail(0x2).ToString();
- UUID userId = TestHelpers.ParseTail(0x3);
-
- J2KDecoderModule j2kdm = new J2KDecoderModule();
-
- Scene scene = SceneHelpers.SetupScene();
- SceneHelpers.SetupSceneModules(scene, j2kdm);
-
- TestClient tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
- LLImageManager llim = new LLImageManager(tc, scene.AssetService, j2kdm);
-
- using (
- Stream resource
- = GetType().Assembly.GetManifestResourceStream(
- "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2"))
- {
- using (BinaryReader br = new BinaryReader(resource))
- {
- AssetBase asset = new AssetBase(imageId, "Test Image", (sbyte)AssetType.Texture, creatorId);
- asset.Data = br.ReadBytes(99999999);
- scene.AssetService.Store(asset);
- }
- }
-
TextureRequestArgs args = new TextureRequestArgs();
- args.RequestedAssetID = imageId;
+ args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
args.PacketNumber = 1;
args.Priority = 5;
@@ -130,7 +122,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
// Now create a discard request
TextureRequestArgs discardArgs = new TextureRequestArgs();
- discardArgs.RequestedAssetID = imageId;
+ discardArgs.RequestedAssetID = m_testImageAsset.FullID;
discardArgs.DiscardLevel = -1;
discardArgs.PacketNumber = 1;
discardArgs.Priority = 0;
--
cgit v1.1
From d38e2c0c91b684d54974865d3ac2fb88c3354c21 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 21:57:12 +0000
Subject: Add image not in database test for LLImageManager
---
OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 3 ++
.../ClientStack/Linden/UDP/LLImageManager.cs | 29 +++++++++++++------
.../Linden/UDP/Tests/LLImageManagerTests.cs | 33 ++++++++++++++++++----
OpenSim/Tests/Common/Mock/TestClient.cs | 6 ++++
4 files changed, 58 insertions(+), 13 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index bbd2c43..8dd76d8 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -377,6 +377,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void AssetReceived(string id, Object sender, AssetBase asset)
{
+// m_log.DebugFormat(
+// "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a");
+
UUID assetID = UUID.Zero;
if (asset != null)
{
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 7bfb844..a48251f 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -55,18 +55,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_shuttingdown;
private AssetBase m_missingImage;
- private IClientAPI m_client; //Client we're assigned to
- private IAssetService m_assetCache; //Asset Cache
- private IJ2KDecoder m_j2kDecodeModule; //Our J2K module
+ private IAssetService m_assetCache;
+ private IJ2KDecoder m_j2kDecodeModule;
+
+ ///
+ /// Priority queue for determining which image to send first.
+ ///
private C5.IntervalHeap m_priorityQueue = new C5.IntervalHeap(10, new J2KImageComparer());
+
+ ///
+ /// Used to control thread access to the priority queue.
+ ///
private object m_syncRoot = new object();
- public IClientAPI Client { get { return m_client; } }
+ ///
+ /// Client served by this image manager
+ ///
+ public IClientAPI Client { get; private set; }
+
public AssetBase MissingImage { get { return m_missingImage; } }
public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule)
{
- m_client = client;
+ Client = client;
m_assetCache = pAssetCache;
if (pAssetCache != null)
@@ -90,7 +101,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Do a linear search for this texture download
lock (m_syncRoot)
+ {
m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
+ }
if (imgrequest != null)
{
@@ -178,8 +191,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
imgrequest = new J2KImage(this);
imgrequest.J2KDecoder = m_j2kDecodeModule;
imgrequest.AssetService = m_assetCache;
- imgrequest.AgentID = m_client.AgentId;
- imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface();
+ imgrequest.AgentID = Client.AgentId;
+ imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface();
imgrequest.DiscardLevel = newRequest.DiscardLevel;
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
imgrequest.Priority = newRequest.Priority;
@@ -210,7 +223,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (image.IsDecoded)
{
int sent;
- bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent);
+ bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent);
packetsSent += sent;
// If the send is complete, destroy any knowledge of this transfer
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
index f176964..1b68d68 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs
@@ -46,6 +46,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
public class LLImageManagerTests
{
private AssetBase m_testImageAsset;
+ private Scene scene;
private LLImageManager llim;
private TestClient tc;
@@ -78,21 +79,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
J2KDecoderModule j2kdm = new J2KDecoderModule();
- Scene scene = SceneHelpers.SetupScene();
+ scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(scene, j2kdm);
- scene.AssetService.Store(m_testImageAsset);
-
tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
llim = new LLImageManager(tc, scene.AssetService, j2kdm);
}
[Test]
- public void TestRequestAndSendImage()
+ public void TestSendImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
+ scene.AssetService.Store(m_testImageAsset);
+
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
@@ -107,11 +108,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
}
[Test]
- public void TestRequestAndDiscardImage()
+ public void TestDiscardImage()
{
TestHelpers.InMethod();
// XmlConfigurator.Configure();
+ scene.AssetService.Store(m_testImageAsset);
+
TextureRequestArgs args = new TextureRequestArgs();
args.RequestedAssetID = m_testImageAsset.FullID;
args.DiscardLevel = 0;
@@ -133,5 +136,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
}
+
+ [Test]
+ public void TestMissingImage()
+ {
+ TestHelpers.InMethod();
+// XmlConfigurator.Configure();
+
+ TextureRequestArgs args = new TextureRequestArgs();
+ args.RequestedAssetID = m_testImageAsset.FullID;
+ args.DiscardLevel = 0;
+ args.PacketNumber = 1;
+ args.Priority = 5;
+ args.requestSequence = 1;
+
+ llim.EnqueueReq(args);
+ llim.ProcessImageQueue(20);
+
+ Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0));
+ Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1));
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 2fc6572..fad757a 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Tests.Common.Mock
public List SentImageDataPackets { get; private set; }
public List SentImagePacketPackets { get; private set; }
+ public List SentImageNotInDatabasePackets { get; private set; }
// disable warning: public events, part of the public API
#pragma warning disable 67
@@ -455,6 +456,7 @@ namespace OpenSim.Tests.Common.Mock
SentImageDataPackets = new List();
SentImagePacketPackets = new List();
+ SentImageNotInDatabasePackets = new List();
}
///
@@ -822,6 +824,10 @@ namespace OpenSim.Tests.Common.Mock
public void SendImageNotFound(UUID imageid)
{
+ ImageNotInDatabasePacket p = new ImageNotInDatabasePacket();
+ p.ImageID.ID = imageid;
+
+ SentImageNotInDatabasePackets.Add(p);
}
public void SendShutdownConnectionNotice()
--
cgit v1.1
From ea72428c9d3fa27ab43bb3e0b2e297bf3b22861e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jan 2012 23:09:16 +0000
Subject: Allow a viewer UDP image request retry to trigger another asset fetch
if an existing fetch hasn't responded before a timeout.
This is to stop a high priority image/texture request from blocking the entire download queue if its asset fetch got dropped for some reason.
---
OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 32 ++++++++++++++++++++--
.../ClientStack/Linden/UDP/LLImageManager.cs | 6 ++--
2 files changed, 32 insertions(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index 8dd76d8..afbe56b 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -45,6 +45,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private const int IMAGE_PACKET_SIZE = 1000;
private const int FIRST_PACKET_SIZE = 600;
+ ///
+ /// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate
+ /// request from the client to trigger a fresh asset request.
+ ///
+ ///
+ /// There are 10,000 ticks in a millisecond
+ ///
+ private const int ASSET_REQUEST_TIMEOUT = 100000000;
+
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public uint LastSequence;
@@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public UUID AgentID;
public IInventoryAccessModule InventoryAccessModule;
private OpenJPEG.J2KLayerInfo[] m_layers;
+
+ ///
+ /// Has this request decoded the asset data?
+ ///
public bool IsDecoded { get; private set; }
+
+ ///
+ /// Has this request received the required asset data?
+ ///
public bool HasAsset { get; private set; }
+
+ ///
+ /// Time in milliseconds at which the asset was requested.
+ ///
+ public long AssetRequestTime { get; private set; }
+
public C5.IPriorityQueueHandle PriorityQueueHandle;
private uint m_currentPacket;
@@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (!HasAsset)
{
- if (!m_assetRequested)
+ if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT)
{
+// m_log.DebugFormat(
+// "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}",
+// TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT);
+
m_assetRequested = true;
-// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID);
+ AssetRequestTime = DateTime.UtcNow.Ticks;
+
AssetService.Get(TextureID.ToString(), this, AssetReceived);
}
}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index a48251f..073c357 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -101,9 +101,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Do a linear search for this texture download
lock (m_syncRoot)
- {
m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
- }
if (imgrequest != null)
{
@@ -124,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
- //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
- // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
+// m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
+// newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
//Check the packet sequence to make sure this isn't older than
//one we've already received
--
cgit v1.1
From b6f3de5028ab9a288f60b020a0dffda079dc550d Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Fri, 20 Jan 2012 23:50:37 -0500
Subject: Telehub Support:
Support for viewer side of telehub management. Can manupulate Telehubs and SpawnPoints from the viewer estate managemnt tools. This is a work in progress and does not yet persist or affect teleport routing.
---
OpenSim/Framework/IClientAPI.cs | 5 +
.../Region/ClientStack/Linden/UDP/LLClientView.cs | 39 ++++++-
.../World/Estate/EstateManagementModule.cs | 65 ++++++++++-
.../CoreModules/World/Estate/TelehubManager.cs | 130 +++++++++++++++++++++
.../Server/IRCClientView.cs | 6 +
.../Region/OptionalModules/World/NPC/NPCAvatar.cs | 5 +
OpenSim/Tests/Common/Mock/TestClient.cs | 5 +
7 files changed, 251 insertions(+), 4 deletions(-)
create mode 100644 OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 29a69c3..1326fe9 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -358,6 +358,8 @@ namespace OpenSim.Framework
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
+ public delegate void EstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, UInt32 param1);
+
public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
public delegate void BakeTerrain(IClientAPI remoteClient);
@@ -769,6 +771,7 @@ namespace OpenSim.Framework
event ModifyTerrain OnModifyTerrain;
event BakeTerrain OnBakeTerrain;
event EstateChangeInfo OnEstateChangeInfo;
+ event EstateManageTelehub OnEstateManageTelehub;
// [Obsolete("LLClientView Specific.")]
event SetAppearance OnSetAppearance;
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
@@ -1141,6 +1144,8 @@ namespace OpenSim.Framework
void SendTaskInventory(UUID taskID, short serial, byte[] fileName);
+ void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint);
+
///
/// Used by the server to inform the client of new inventory items and folders.
///
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 4ba441e..a94fb20 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -219,6 +219,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event BakeTerrain OnBakeTerrain;
public event RequestTerrain OnUploadTerrain;
public event EstateChangeInfo OnEstateChangeInfo;
+ public event EstateManageTelehub OnEstateManageTelehub;
public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
@@ -4482,6 +4483,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task);
}
+ public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint)
+ {
+ TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo);
+ packet.TelehubBlock.ObjectID = ObjectID;
+ packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName);
+ packet.TelehubBlock.TelehubPos = ObjectPos;
+ packet.TelehubBlock.TelehubRot = ObjectRot;
+
+ packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count];
+ for (int n = 0; n < SpawnPoint.Count; n++)
+ {
+ packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]};
+ }
+
+ OutPacket(packet, ThrottleOutPacketType.Task);
+ }
+
#endregion
#region Land Data Sending Methods
@@ -8920,7 +8938,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack)
{
EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack;
- //m_log.Debug(messagePacket.ToString());
+ // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method));
GodLandStatRequest handlerLandStatRequest;
#region Packet Session and User Check
@@ -9219,6 +9237,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
return true;
+ case "telehub":
+ if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
+ {
+ UUID invoice = messagePacket.MethodData.Invoice;
+ UUID SenderID = messagePacket.AgentData.AgentID;
+ UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter));
+
+ string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter);
+
+ EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub;
+ if (handlerEstateManageTelehub != null)
+ {
+ handlerEstateManageTelehub(this, invoice, SenderID, command, param1);
+ }
+ }
+ return true;
+
default:
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket);
return true;
@@ -9230,8 +9265,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts
//lsrp.RequestData.RequestFlags;
//lsrp.RequestData.Filter;
-
-// return true;
}
private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 58d9455..0d4df6c 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected EstateManagementCommands m_commands;
private EstateTerrainXferHandler TerrainUploader;
+ private TelehubManager m_Telehub;
public event ChangeDelegate OnRegionInfoChange;
public event ChangeDelegate OnEstateInfoChange;
@@ -599,6 +600,65 @@ namespace OpenSim.Region.CoreModules.World.Estate
}
}
+ private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
+ {
+ uint ObjectLocalID;
+ SceneObjectPart part;
+ // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID;
+ TelehubManager.Telehub telehub;
+
+ switch (cmd)
+ {
+ case "info ui":
+ // Send info:
+ if (m_Telehub.HasTelehub)
+ {
+ telehub = m_Telehub.TelehubVals();
+ client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
+ telehub.ObjectRotation, telehub.SpawnPoint);
+ }
+ else
+ {
+ return;
+ }
+ break;
+
+ case "connect":
+ // Add the Telehub
+ part = Scene.GetSceneObjectPart((uint)param1);
+ telehub = m_Telehub.Connect(part);
+ client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
+ telehub.ObjectRotation, telehub.SpawnPoint);
+ break;
+
+ case "delete":
+ // Disconnect Telehub
+ part = Scene.GetSceneObjectPart((uint)param1);
+ telehub = m_Telehub.DisConnect(part);
+ client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
+ telehub.ObjectRotation, telehub.SpawnPoint);
+ break;
+
+ case "spawnpoint add":
+ // Add SpawnPoint to the Telehub
+ part = Scene.GetSceneObjectPart((uint)param1);
+ telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition);
+ client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
+ telehub.ObjectRotation, telehub.SpawnPoint);
+ break;
+
+ case "spawnpoint remove":
+ // Remove SpawnPoint from Telehub
+ telehub = m_Telehub.RemoveSpawnPoint((int)param1);
+ client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition,
+ telehub.ObjectRotation, telehub.SpawnPoint);
+ break;
+
+ default:
+ break;
+ }
+ }
+
private void SendSimulatorBlueBoxMessage(
IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)
{
@@ -1055,7 +1115,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegisterModuleInterface(this);
Scene.EventManager.OnNewClient += EventManager_OnNewClient;
Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
-
+
+ m_Telehub = new TelehubManager(scene);
+
m_commands = new EstateManagementCommands(this);
m_commands.Initialise();
}
@@ -1109,6 +1171,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
client.OnEstateChangeInfo += handleEstateChangeInfo;
+ client.OnEstateManageTelehub += handleOnEstateManageTelehub;
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
diff --git a/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
new file mode 100644
index 0000000..c99c9ba
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Estate/TelehubManager.cs
@@ -0,0 +1,130 @@
+/*
+ * 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 OpenMetaverse;
+using System.Collections.Generic;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Scenes;
+
+namespace OpenSim.Region.CoreModules.World.Estate
+{
+ public class TelehubManager
+ {
+ public struct Telehub
+ {
+ public UUID ObjectID;
+ public string ObjectName;
+ public Vector3 ObjectPosition;
+ public Quaternion ObjectRotation;
+ public List SpawnPoint;
+ };
+
+ private UUID ObjectID;
+ private string ObjectName;
+ private Vector3 ObjectPosition;
+ Quaternion ObjectRotation;
+ List SpawnPoint = new List();
+ UUID EstateID;
+ bool m_HasTelehub = false;
+ Scene m_Scene;
+ // This will get an option...
+ Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f);
+
+ public bool HasTelehub
+ {
+ get { return m_HasTelehub; }
+ }
+
+ public TelehubManager(Scene scene)
+ {
+ m_Scene = scene;
+ }
+
+ // Fill our Telehub struct with values
+ public Telehub TelehubVals()
+ {
+ Telehub telehub = new Telehub();
+
+ telehub.ObjectID = ObjectID;
+ telehub.ObjectName = ObjectName;
+ telehub.ObjectPosition = ObjectPosition;
+ telehub.ObjectRotation = ObjectRotation;
+ telehub.SpawnPoint = SpawnPoint;
+ return telehub;
+ }
+
+ // Connect the Telehub
+ public Telehub Connect(SceneObjectPart part)
+ {
+ ObjectID = part.UUID;
+ ObjectName = part.Name;
+ ObjectPosition = part.AbsolutePosition;
+ ObjectRotation = part.GetWorldRotation();
+ // Clear this for now
+ SpawnPoint.Clear();
+ SpawnPoint.Add(InitialSpawnPoint);
+ m_HasTelehub = true;
+
+ return TelehubVals();
+ }
+
+ // Disconnect the Telehub
+ public Telehub DisConnect(SceneObjectPart part)
+ {
+ ObjectID = UUID.Zero;
+ ObjectName = String.Empty;
+ ObjectPosition = Vector3.Zero;
+ ObjectRotation = Quaternion.Identity;
+ SpawnPoint.Clear();
+ m_HasTelehub = false;
+
+ return TelehubVals();
+ }
+
+ // Add a SpawnPoint to the Telehub
+ public Telehub AddSpawnPoint(Vector3 point)
+ {
+ float dist = (float) Util.GetDistanceTo(ObjectPosition, point);
+
+ Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition);
+
+ Vector3 spoint = nvec * dist;
+
+ SpawnPoint.Add(spoint);
+ return TelehubVals();
+ }
+
+ // Remove a SpawnPoint from the Telehub
+ public Telehub RemoveSpawnPoint(int spawnpoint)
+ {
+ SpawnPoint.RemoveAt(spawnpoint);
+
+ return TelehubVals();
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 32de85f..bbf3729 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -658,6 +658,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event ModifyTerrain OnModifyTerrain;
public event BakeTerrain OnBakeTerrain;
public event EstateChangeInfo OnEstateChangeInfo;
+ public event EstateManageTelehub OnEstateManageTelehub;
public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
@@ -1530,6 +1531,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
+ public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint)
+ {
+
+ }
+
public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags)
{
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 5f4f937..6a6c4c3 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -32,6 +32,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
+using OpenSim.Region.CoreModules.World.Estate;
namespace OpenSim.Region.OptionalModules.World.NPC
{
@@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest;
public event EstateChangeInfo OnEstateChangeInfo;
+ public event EstateManageTelehub OnEstateManageTelehub;
public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning;
@@ -923,6 +925,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public void SendEstateCovenantInformation(UUID covenant)
{
}
+ public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint)
+ {
+ }
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
{
}
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 2fc6572..8a71dfd 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -193,6 +193,7 @@ namespace OpenSim.Tests.Common.Mock
public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest;
public event EstateChangeInfo OnEstateChangeInfo;
+ public event EstateManageTelehub OnEstateManageTelehub;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
@@ -945,6 +946,10 @@ namespace OpenSim.Tests.Common.Mock
{
}
+ public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint)
+ {
+ }
+
public void SendEstateList(UUID invoice, int code, UUID[] Data, uint estateID)
{
}
--
cgit v1.1