diff options
author | Melanie | 2012-01-21 19:52:33 +0000 |
---|---|---|
committer | Melanie | 2012-01-21 19:52:33 +0000 |
commit | ba3b0c69f11aaa3b4305cddd57099e98325a146d (patch) | |
tree | cf70355a8cac0579354e67eeb3632a6706d41012 /OpenSim/Region | |
parent | Add some logging (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-ba3b0c69f11aaa3b4305cddd57099e98325a146d.zip opensim-SC-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.gz opensim-SC-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.bz2 opensim-SC-ba3b0c69f11aaa3b4305cddd57099e98325a146d.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region')
16 files changed, 677 insertions, 40 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index 8aa2ff3..3995620 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 | |||
45 | private const int IMAGE_PACKET_SIZE = 1000; | 45 | private const int IMAGE_PACKET_SIZE = 1000; |
46 | private const int FIRST_PACKET_SIZE = 600; | 46 | private const int FIRST_PACKET_SIZE = 600; |
47 | 47 | ||
48 | /// <summary> | ||
49 | /// If we've requested an asset but not received it in this ticks timeframe, then allow a duplicate | ||
50 | /// request from the client to trigger a fresh asset request. | ||
51 | /// </summary> | ||
52 | /// <remarks> | ||
53 | /// There are 10,000 ticks in a millisecond | ||
54 | /// </remarks> | ||
55 | private const int ASSET_REQUEST_TIMEOUT = 100000000; | ||
56 | |||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 58 | ||
50 | public uint LastSequence; | 59 | public uint LastSequence; |
@@ -57,8 +66,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
57 | public UUID AgentID; | 66 | public UUID AgentID; |
58 | public IInventoryAccessModule InventoryAccessModule; | 67 | public IInventoryAccessModule InventoryAccessModule; |
59 | private OpenJPEG.J2KLayerInfo[] m_layers; | 68 | private OpenJPEG.J2KLayerInfo[] m_layers; |
69 | |||
70 | /// <summary> | ||
71 | /// Has this request decoded the asset data? | ||
72 | /// </summary> | ||
60 | public bool IsDecoded { get; private set; } | 73 | public bool IsDecoded { get; private set; } |
74 | |||
75 | /// <summary> | ||
76 | /// Has this request received the required asset data? | ||
77 | /// </summary> | ||
61 | public bool HasAsset { get; private set; } | 78 | public bool HasAsset { get; private set; } |
79 | |||
80 | /// <summary> | ||
81 | /// Time in milliseconds at which the asset was requested. | ||
82 | /// </summary> | ||
83 | public long AssetRequestTime { get; private set; } | ||
84 | |||
62 | public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; | 85 | public C5.IPriorityQueueHandle<J2KImage> PriorityQueueHandle; |
63 | 86 | ||
64 | private uint m_currentPacket; | 87 | private uint m_currentPacket; |
@@ -82,7 +105,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
82 | /// <param name="packetsToSend">Maximum number of packets to send during this call</param> | 105 | /// <param name="packetsToSend">Maximum number of packets to send during this call</param> |
83 | /// <param name="packetsSent">Number of packets sent during this call</param> | 106 | /// <param name="packetsSent">Number of packets sent during this call</param> |
84 | /// <returns>True if the transfer completes at the current discard level, otherwise false</returns> | 107 | /// <returns>True if the transfer completes at the current discard level, otherwise false</returns> |
85 | public bool SendPackets(LLClientView client, int packetsToSend, out int packetsSent) | 108 | public bool SendPackets(IClientAPI client, int packetsToSend, out int packetsSent) |
86 | { | 109 | { |
87 | packetsSent = 0; | 110 | packetsSent = 0; |
88 | 111 | ||
@@ -123,10 +146,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
123 | { | 146 | { |
124 | if (!HasAsset) | 147 | if (!HasAsset) |
125 | { | 148 | { |
126 | if (!m_assetRequested) | 149 | if (!m_assetRequested || DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT) |
127 | { | 150 | { |
151 | // m_log.DebugFormat( | ||
152 | // "[J2KIMAGE]: Requesting asset {0} from request in packet {1}, already requested? {2}, due to timeout? {3}", | ||
153 | // TextureID, LastSequence, m_assetRequested, DateTime.UtcNow.Ticks > AssetRequestTime + ASSET_REQUEST_TIMEOUT); | ||
154 | |||
128 | m_assetRequested = true; | 155 | m_assetRequested = true; |
129 | // m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID); | 156 | AssetRequestTime = DateTime.UtcNow.Ticks; |
157 | |||
130 | AssetService.Get(TextureID.ToString(), this, AssetReceived); | 158 | AssetService.Get(TextureID.ToString(), this, AssetReceived); |
131 | } | 159 | } |
132 | } | 160 | } |
@@ -215,7 +243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
215 | } | 243 | } |
216 | } | 244 | } |
217 | 245 | ||
218 | private bool SendFirstPacket(LLClientView client) | 246 | private bool SendFirstPacket(IClientAPI client) |
219 | { | 247 | { |
220 | if (client == null) | 248 | if (client == null) |
221 | return false; | 249 | return false; |
@@ -250,7 +278,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
250 | return false; | 278 | return false; |
251 | } | 279 | } |
252 | 280 | ||
253 | private bool SendPacket(LLClientView client) | 281 | private bool SendPacket(IClientAPI client) |
254 | { | 282 | { |
255 | if (client == null) | 283 | if (client == null) |
256 | return false; | 284 | return false; |
@@ -380,6 +408,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
380 | 408 | ||
381 | private void AssetReceived(string id, Object sender, AssetBase asset) | 409 | private void AssetReceived(string id, Object sender, AssetBase asset) |
382 | { | 410 | { |
411 | // m_log.DebugFormat( | ||
412 | // "[J2KIMAGE]: Received asset {0} ({1} bytes)", id, asset != null ? asset.Data.Length.ToString() : "n/a"); | ||
413 | |||
383 | UUID assetID = UUID.Zero; | 414 | UUID assetID = UUID.Zero; |
384 | if (asset != null) | 415 | if (asset != null) |
385 | { | 416 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 01e1383..d9dc6b7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -220,6 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
220 | public event BakeTerrain OnBakeTerrain; | 220 | public event BakeTerrain OnBakeTerrain; |
221 | public event RequestTerrain OnUploadTerrain; | 221 | public event RequestTerrain OnUploadTerrain; |
222 | public event EstateChangeInfo OnEstateChangeInfo; | 222 | public event EstateChangeInfo OnEstateChangeInfo; |
223 | public event EstateManageTelehub OnEstateManageTelehub; | ||
223 | public event EstateRestartSimRequest OnEstateRestartSimRequest; | 224 | public event EstateRestartSimRequest OnEstateRestartSimRequest; |
224 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; | 225 | public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; |
225 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; | 226 | public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; |
@@ -4537,6 +4538,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4537 | OutPacket(packet, ThrottleOutPacketType.Task); | 4538 | OutPacket(packet, ThrottleOutPacketType.Task); |
4538 | } | 4539 | } |
4539 | 4540 | ||
4541 | public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint) | ||
4542 | { | ||
4543 | TelehubInfoPacket packet = (TelehubInfoPacket)PacketPool.Instance.GetPacket(PacketType.TelehubInfo); | ||
4544 | packet.TelehubBlock.ObjectID = ObjectID; | ||
4545 | packet.TelehubBlock.ObjectName = Utils.StringToBytes(ObjectName); | ||
4546 | packet.TelehubBlock.TelehubPos = ObjectPos; | ||
4547 | packet.TelehubBlock.TelehubRot = ObjectRot; | ||
4548 | |||
4549 | packet.SpawnPointBlock = new TelehubInfoPacket.SpawnPointBlockBlock[SpawnPoint.Count]; | ||
4550 | for (int n = 0; n < SpawnPoint.Count; n++) | ||
4551 | { | ||
4552 | packet.SpawnPointBlock[n] = new TelehubInfoPacket.SpawnPointBlockBlock{SpawnPointPos = SpawnPoint[n]}; | ||
4553 | } | ||
4554 | |||
4555 | OutPacket(packet, ThrottleOutPacketType.Task); | ||
4556 | } | ||
4557 | |||
4540 | #endregion | 4558 | #endregion |
4541 | 4559 | ||
4542 | #region Land Data Sending Methods | 4560 | #region Land Data Sending Methods |
@@ -8981,7 +8999,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8981 | private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) | 8999 | private bool HandleEstateOwnerMessage(IClientAPI sender, Packet Pack) |
8982 | { | 9000 | { |
8983 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; | 9001 | EstateOwnerMessagePacket messagePacket = (EstateOwnerMessagePacket)Pack; |
8984 | //m_log.Debug(messagePacket.ToString()); | 9002 | // m_log.InfoFormat("[LLCLIENTVIEW]: Packet: {0}", Utils.BytesToString(messagePacket.MethodData.Method)); |
8985 | GodLandStatRequest handlerLandStatRequest; | 9003 | GodLandStatRequest handlerLandStatRequest; |
8986 | 9004 | ||
8987 | #region Packet Session and User Check | 9005 | #region Packet Session and User Check |
@@ -9280,6 +9298,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9280 | } | 9298 | } |
9281 | return true; | 9299 | return true; |
9282 | 9300 | ||
9301 | case "telehub": | ||
9302 | if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) | ||
9303 | { | ||
9304 | UUID invoice = messagePacket.MethodData.Invoice; | ||
9305 | UUID SenderID = messagePacket.AgentData.AgentID; | ||
9306 | UInt32 param1 = Convert.ToUInt32(Utils.BytesToString(messagePacket.ParamList[1].Parameter)); | ||
9307 | |||
9308 | string command = (string)Utils.BytesToString(messagePacket.ParamList[0].Parameter); | ||
9309 | |||
9310 | EstateManageTelehub handlerEstateManageTelehub = OnEstateManageTelehub; | ||
9311 | if (handlerEstateManageTelehub != null) | ||
9312 | { | ||
9313 | handlerEstateManageTelehub(this, invoice, SenderID, command, param1); | ||
9314 | } | ||
9315 | } | ||
9316 | return true; | ||
9317 | |||
9283 | default: | 9318 | default: |
9284 | m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); | 9319 | m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); |
9285 | return true; | 9320 | return true; |
@@ -9291,8 +9326,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
9291 | //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts | 9326 | //lsrp.RequestData.ReportType; // 1 = colliders, 0 = scripts |
9292 | //lsrp.RequestData.RequestFlags; | 9327 | //lsrp.RequestData.RequestFlags; |
9293 | //lsrp.RequestData.Filter; | 9328 | //lsrp.RequestData.Filter; |
9294 | |||
9295 | // return true; | ||
9296 | } | 9329 | } |
9297 | 9330 | ||
9298 | private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) | 9331 | private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs index db428f1..073c357 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 | |||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | private bool m_shuttingdown; | 56 | private bool m_shuttingdown; |
57 | private AssetBase m_missingImage; | 57 | private AssetBase m_missingImage; |
58 | private LLClientView m_client; //Client we're assigned to | 58 | private IAssetService m_assetCache; |
59 | private IAssetService m_assetCache; //Asset Cache | 59 | private IJ2KDecoder m_j2kDecodeModule; |
60 | private IJ2KDecoder m_j2kDecodeModule; //Our J2K module | 60 | |
61 | /// <summary> | ||
62 | /// Priority queue for determining which image to send first. | ||
63 | /// </summary> | ||
61 | private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); | 64 | private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer()); |
65 | |||
66 | /// <summary> | ||
67 | /// Used to control thread access to the priority queue. | ||
68 | /// </summary> | ||
62 | private object m_syncRoot = new object(); | 69 | private object m_syncRoot = new object(); |
63 | 70 | ||
64 | public LLClientView Client { get { return m_client; } } | 71 | /// <summary> |
72 | /// Client served by this image manager | ||
73 | /// </summary> | ||
74 | public IClientAPI Client { get; private set; } | ||
75 | |||
65 | public AssetBase MissingImage { get { return m_missingImage; } } | 76 | public AssetBase MissingImage { get { return m_missingImage; } } |
66 | 77 | ||
67 | public LLImageManager(LLClientView client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) | 78 | public LLImageManager(IClientAPI client, IAssetService pAssetCache, IJ2KDecoder pJ2kDecodeModule) |
68 | { | 79 | { |
69 | m_client = client; | 80 | Client = client; |
70 | m_assetCache = pAssetCache; | 81 | m_assetCache = pAssetCache; |
71 | 82 | ||
72 | if (pAssetCache != null) | 83 | if (pAssetCache != null) |
@@ -111,8 +122,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
111 | // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", | 122 | // "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}", |
112 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); | 123 | // newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name); |
113 | 124 | ||
114 | //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", | 125 | // m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", |
115 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); | 126 | // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); |
116 | 127 | ||
117 | //Check the packet sequence to make sure this isn't older than | 128 | //Check the packet sequence to make sure this isn't older than |
118 | //one we've already received | 129 | //one we've already received |
@@ -178,8 +189,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
178 | imgrequest = new J2KImage(this); | 189 | imgrequest = new J2KImage(this); |
179 | imgrequest.J2KDecoder = m_j2kDecodeModule; | 190 | imgrequest.J2KDecoder = m_j2kDecodeModule; |
180 | imgrequest.AssetService = m_assetCache; | 191 | imgrequest.AssetService = m_assetCache; |
181 | imgrequest.AgentID = m_client.AgentId; | 192 | imgrequest.AgentID = Client.AgentId; |
182 | imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>(); | 193 | imgrequest.InventoryAccessModule = Client.Scene.RequestModuleInterface<IInventoryAccessModule>(); |
183 | imgrequest.DiscardLevel = newRequest.DiscardLevel; | 194 | imgrequest.DiscardLevel = newRequest.DiscardLevel; |
184 | imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); | 195 | imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber); |
185 | imgrequest.Priority = newRequest.Priority; | 196 | imgrequest.Priority = newRequest.Priority; |
@@ -210,7 +221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
210 | if (image.IsDecoded) | 221 | if (image.IsDecoded) |
211 | { | 222 | { |
212 | int sent; | 223 | int sent; |
213 | bool imageDone = image.SendPackets(m_client, packetsToSend - packetsSent, out sent); | 224 | bool imageDone = image.SendPackets(Client, packetsToSend - packetsSent, out sent); |
214 | packetsSent += sent; | 225 | packetsSent += sent; |
215 | 226 | ||
216 | // If the send is complete, destroy any knowledge of this transfer | 227 | // If the send is complete, destroy any knowledge of this transfer |
@@ -246,6 +257,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
246 | } | 257 | } |
247 | 258 | ||
248 | /// <summary> | 259 | /// <summary> |
260 | /// Clear the image queue. | ||
261 | /// </summary> | ||
262 | /// <returns>The number of requests cleared.</returns> | ||
263 | public int ClearImageQueue() | ||
264 | { | ||
265 | int requestsDeleted; | ||
266 | |||
267 | lock (m_priorityQueue) | ||
268 | { | ||
269 | requestsDeleted = m_priorityQueue.Count; | ||
270 | |||
271 | // Surprisingly, there doesn't seem to be a clear method at this time. | ||
272 | while (!m_priorityQueue.IsEmpty) | ||
273 | m_priorityQueue.DeleteMax(); | ||
274 | } | ||
275 | |||
276 | return requestsDeleted; | ||
277 | } | ||
278 | |||
279 | /// <summary> | ||
249 | /// Returns an array containing all the images in the queue. | 280 | /// Returns an array containing all the images in the queue. |
250 | /// </summary> | 281 | /// </summary> |
251 | /// <returns></returns> | 282 | /// <returns></returns> |
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..1b68d68 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Reflection; | ||
32 | using log4net.Config; | ||
33 | using Nini.Config; | ||
34 | using NUnit.Framework; | ||
35 | using OpenMetaverse; | ||
36 | using OpenMetaverse.Packets; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Region.CoreModules.Agent.TextureSender; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Tests.Common; | ||
41 | using OpenSim.Tests.Common.Mock; | ||
42 | |||
43 | namespace OpenSim.Region.ClientStack.LindenUDP.Tests | ||
44 | { | ||
45 | [TestFixture] | ||
46 | public class LLImageManagerTests | ||
47 | { | ||
48 | private AssetBase m_testImageAsset; | ||
49 | private Scene scene; | ||
50 | private LLImageManager llim; | ||
51 | private TestClient tc; | ||
52 | |||
53 | [TestFixtureSetUp] | ||
54 | public void FixtureInit() | ||
55 | { | ||
56 | using ( | ||
57 | Stream resource | ||
58 | = GetType().Assembly.GetManifestResourceStream( | ||
59 | "OpenSim.Region.ClientStack.LindenUDP.Tests.Resources.4-tile2.jp2")) | ||
60 | { | ||
61 | using (BinaryReader br = new BinaryReader(resource)) | ||
62 | { | ||
63 | m_testImageAsset | ||
64 | = new AssetBase( | ||
65 | TestHelpers.ParseTail(0x1), | ||
66 | "Test Image", | ||
67 | (sbyte)AssetType.Texture, | ||
68 | TestHelpers.ParseTail(0x2).ToString()); | ||
69 | |||
70 | m_testImageAsset.Data = br.ReadBytes(99999999); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | [SetUp] | ||
76 | public void SetUp() | ||
77 | { | ||
78 | UUID userId = TestHelpers.ParseTail(0x3); | ||
79 | |||
80 | J2KDecoderModule j2kdm = new J2KDecoderModule(); | ||
81 | |||
82 | scene = SceneHelpers.SetupScene(); | ||
83 | SceneHelpers.SetupSceneModules(scene, j2kdm); | ||
84 | |||
85 | tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); | ||
86 | llim = new LLImageManager(tc, scene.AssetService, j2kdm); | ||
87 | } | ||
88 | |||
89 | [Test] | ||
90 | public void TestSendImage() | ||
91 | { | ||
92 | TestHelpers.InMethod(); | ||
93 | // XmlConfigurator.Configure(); | ||
94 | |||
95 | scene.AssetService.Store(m_testImageAsset); | ||
96 | |||
97 | TextureRequestArgs args = new TextureRequestArgs(); | ||
98 | args.RequestedAssetID = m_testImageAsset.FullID; | ||
99 | args.DiscardLevel = 0; | ||
100 | args.PacketNumber = 1; | ||
101 | args.Priority = 5; | ||
102 | args.requestSequence = 1; | ||
103 | |||
104 | llim.EnqueueReq(args); | ||
105 | llim.ProcessImageQueue(20); | ||
106 | |||
107 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(1)); | ||
108 | } | ||
109 | |||
110 | [Test] | ||
111 | public void TestDiscardImage() | ||
112 | { | ||
113 | TestHelpers.InMethod(); | ||
114 | // XmlConfigurator.Configure(); | ||
115 | |||
116 | scene.AssetService.Store(m_testImageAsset); | ||
117 | |||
118 | TextureRequestArgs args = new TextureRequestArgs(); | ||
119 | args.RequestedAssetID = m_testImageAsset.FullID; | ||
120 | args.DiscardLevel = 0; | ||
121 | args.PacketNumber = 1; | ||
122 | args.Priority = 5; | ||
123 | args.requestSequence = 1; | ||
124 | llim.EnqueueReq(args); | ||
125 | |||
126 | // Now create a discard request | ||
127 | TextureRequestArgs discardArgs = new TextureRequestArgs(); | ||
128 | discardArgs.RequestedAssetID = m_testImageAsset.FullID; | ||
129 | discardArgs.DiscardLevel = -1; | ||
130 | discardArgs.PacketNumber = 1; | ||
131 | discardArgs.Priority = 0; | ||
132 | discardArgs.requestSequence = 2; | ||
133 | llim.EnqueueReq(discardArgs); | ||
134 | |||
135 | llim.ProcessImageQueue(20); | ||
136 | |||
137 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); | ||
138 | } | ||
139 | |||
140 | [Test] | ||
141 | public void TestMissingImage() | ||
142 | { | ||
143 | TestHelpers.InMethod(); | ||
144 | // XmlConfigurator.Configure(); | ||
145 | |||
146 | TextureRequestArgs args = new TextureRequestArgs(); | ||
147 | args.RequestedAssetID = m_testImageAsset.FullID; | ||
148 | args.DiscardLevel = 0; | ||
149 | args.PacketNumber = 1; | ||
150 | args.Priority = 5; | ||
151 | args.requestSequence = 1; | ||
152 | |||
153 | llim.EnqueueReq(args); | ||
154 | llim.ProcessImageQueue(20); | ||
155 | |||
156 | Assert.That(tc.SentImageDataPackets.Count, Is.EqualTo(0)); | ||
157 | Assert.That(tc.SentImageNotInDatabasePackets.Count, Is.EqualTo(1)); | ||
158 | } | ||
159 | } | ||
160 | } \ 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 --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/Resources/4-tile2.jp2 | |||
Binary files differ | |||
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 | |||
100 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); | 100 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); |
101 | 101 | ||
102 | // Send a message to the region ready module | 102 | // Send a message to the region ready module |
103 | /* bluewall* Disable this for the time being | ||
103 | IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>(); | 104 | IRegionReadyModule rready = m_scene.RequestModuleInterface<IRegionReadyModule>(); |
104 | 105 | ||
105 | if (rready != null) | 106 | if (rready != null) |
106 | { | 107 | { |
107 | rready.OarLoadingAlert("load"); | 108 | rready.OarLoadingAlert("load"); |
108 | } | 109 | } |
110 | */ | ||
109 | 111 | ||
110 | List<string> mainParams = options.Parse(cmdparams); | 112 | List<string> mainParams = options.Parse(cmdparams); |
111 | 113 | ||
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 | |||
344 | { | 344 | { |
345 | using (BinaryReader br = new BinaryReader(resource)) | 345 | using (BinaryReader br = new BinaryReader(resource)) |
346 | { | 346 | { |
347 | // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion | 347 | // FIXME: Use the inspector instead |
348 | soundData = br.ReadBytes(99999999); | 348 | soundData = br.ReadBytes(99999999); |
349 | UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 349 | UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
350 | string soundAssetFileName | 350 | string soundAssetFileName |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 30695ff..35ad939 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
55 | protected EstateManagementCommands m_commands; | 55 | protected EstateManagementCommands m_commands; |
56 | 56 | ||
57 | private EstateTerrainXferHandler TerrainUploader; | 57 | private EstateTerrainXferHandler TerrainUploader; |
58 | private TelehubManager m_Telehub; | ||
58 | 59 | ||
59 | public event ChangeDelegate OnRegionInfoChange; | 60 | public event ChangeDelegate OnRegionInfoChange; |
60 | public event ChangeDelegate OnEstateInfoChange; | 61 | public event ChangeDelegate OnEstateInfoChange; |
@@ -614,6 +615,65 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
614 | } | 615 | } |
615 | } | 616 | } |
616 | 617 | ||
618 | private void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | ||
619 | { | ||
620 | uint ObjectLocalID; | ||
621 | SceneObjectPart part; | ||
622 | // UUID EstateID = Scene.RegionInfo.EstateSettings.EstateID; | ||
623 | TelehubManager.Telehub telehub; | ||
624 | |||
625 | switch (cmd) | ||
626 | { | ||
627 | case "info ui": | ||
628 | // Send info: | ||
629 | if (m_Telehub.HasTelehub) | ||
630 | { | ||
631 | telehub = m_Telehub.TelehubVals(); | ||
632 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
633 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
634 | } | ||
635 | else | ||
636 | { | ||
637 | return; | ||
638 | } | ||
639 | break; | ||
640 | |||
641 | case "connect": | ||
642 | // Add the Telehub | ||
643 | part = Scene.GetSceneObjectPart((uint)param1); | ||
644 | telehub = m_Telehub.Connect(part); | ||
645 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
646 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
647 | break; | ||
648 | |||
649 | case "delete": | ||
650 | // Disconnect Telehub | ||
651 | part = Scene.GetSceneObjectPart((uint)param1); | ||
652 | telehub = m_Telehub.DisConnect(part); | ||
653 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
654 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
655 | break; | ||
656 | |||
657 | case "spawnpoint add": | ||
658 | // Add SpawnPoint to the Telehub | ||
659 | part = Scene.GetSceneObjectPart((uint)param1); | ||
660 | telehub = m_Telehub.AddSpawnPoint(part.AbsolutePosition); | ||
661 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
662 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
663 | break; | ||
664 | |||
665 | case "spawnpoint remove": | ||
666 | // Remove SpawnPoint from Telehub | ||
667 | telehub = m_Telehub.RemoveSpawnPoint((int)param1); | ||
668 | client.SendTelehubInfo(telehub.ObjectID, telehub.ObjectName, telehub.ObjectPosition, | ||
669 | telehub.ObjectRotation, telehub.SpawnPoint); | ||
670 | break; | ||
671 | |||
672 | default: | ||
673 | break; | ||
674 | } | ||
675 | } | ||
676 | |||
617 | private void SendSimulatorBlueBoxMessage( | 677 | private void SendSimulatorBlueBoxMessage( |
618 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) | 678 | IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) |
619 | { | 679 | { |
@@ -1084,7 +1144,9 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1084 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1144 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1085 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1145 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
1086 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | 1146 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; |
1087 | 1147 | ||
1148 | m_Telehub = new TelehubManager(scene); | ||
1149 | |||
1088 | m_commands = new EstateManagementCommands(this); | 1150 | m_commands = new EstateManagementCommands(this); |
1089 | m_commands.Initialise(); | 1151 | m_commands.Initialise(); |
1090 | } | 1152 | } |
@@ -1138,6 +1200,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1138 | client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; | 1200 | client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; |
1139 | client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; | 1201 | client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; |
1140 | client.OnEstateChangeInfo += handleEstateChangeInfo; | 1202 | client.OnEstateChangeInfo += handleEstateChangeInfo; |
1203 | client.OnEstateManageTelehub += handleOnEstateManageTelehub; | ||
1141 | client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; | 1204 | client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; |
1142 | client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; | 1205 | client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; |
1143 | client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; | 1206 | 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 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using System.Collections.Generic; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.CoreModules.World.Estate | ||
35 | { | ||
36 | public class TelehubManager | ||
37 | { | ||
38 | public struct Telehub | ||
39 | { | ||
40 | public UUID ObjectID; | ||
41 | public string ObjectName; | ||
42 | public Vector3 ObjectPosition; | ||
43 | public Quaternion ObjectRotation; | ||
44 | public List<Vector3> SpawnPoint; | ||
45 | }; | ||
46 | |||
47 | private UUID ObjectID; | ||
48 | private string ObjectName; | ||
49 | private Vector3 ObjectPosition; | ||
50 | Quaternion ObjectRotation; | ||
51 | List<Vector3> SpawnPoint = new List<Vector3>(); | ||
52 | UUID EstateID; | ||
53 | bool m_HasTelehub = false; | ||
54 | Scene m_Scene; | ||
55 | // This will get an option... | ||
56 | Vector3 InitialSpawnPoint = new Vector3(0.0f,0.0f,-3.0f); | ||
57 | |||
58 | public bool HasTelehub | ||
59 | { | ||
60 | get { return m_HasTelehub; } | ||
61 | } | ||
62 | |||
63 | public TelehubManager(Scene scene) | ||
64 | { | ||
65 | m_Scene = scene; | ||
66 | } | ||
67 | |||
68 | // Fill our Telehub struct with values | ||
69 | public Telehub TelehubVals() | ||
70 | { | ||
71 | Telehub telehub = new Telehub(); | ||
72 | |||
73 | telehub.ObjectID = ObjectID; | ||
74 | telehub.ObjectName = ObjectName; | ||
75 | telehub.ObjectPosition = ObjectPosition; | ||
76 | telehub.ObjectRotation = ObjectRotation; | ||
77 | telehub.SpawnPoint = SpawnPoint; | ||
78 | return telehub; | ||
79 | } | ||
80 | |||
81 | // Connect the Telehub | ||
82 | public Telehub Connect(SceneObjectPart part) | ||
83 | { | ||
84 | ObjectID = part.UUID; | ||
85 | ObjectName = part.Name; | ||
86 | ObjectPosition = part.AbsolutePosition; | ||
87 | ObjectRotation = part.GetWorldRotation(); | ||
88 | // Clear this for now | ||
89 | SpawnPoint.Clear(); | ||
90 | SpawnPoint.Add(InitialSpawnPoint); | ||
91 | m_HasTelehub = true; | ||
92 | |||
93 | return TelehubVals(); | ||
94 | } | ||
95 | |||
96 | // Disconnect the Telehub | ||
97 | public Telehub DisConnect(SceneObjectPart part) | ||
98 | { | ||
99 | ObjectID = UUID.Zero; | ||
100 | ObjectName = String.Empty; | ||
101 | ObjectPosition = Vector3.Zero; | ||
102 | ObjectRotation = Quaternion.Identity; | ||
103 | SpawnPoint.Clear(); | ||
104 | m_HasTelehub = false; | ||
105 | |||
106 | return TelehubVals(); | ||
107 | } | ||
108 | |||
109 | // Add a SpawnPoint to the Telehub | ||
110 | public Telehub AddSpawnPoint(Vector3 point) | ||
111 | { | ||
112 | float dist = (float) Util.GetDistanceTo(ObjectPosition, point); | ||
113 | |||
114 | Vector3 nvec = Util.GetNormalizedVector(point - ObjectPosition); | ||
115 | |||
116 | Vector3 spoint = nvec * dist; | ||
117 | |||
118 | SpawnPoint.Add(spoint); | ||
119 | return TelehubVals(); | ||
120 | } | ||
121 | |||
122 | // Remove a SpawnPoint from the Telehub | ||
123 | public Telehub RemoveSpawnPoint(int spawnpoint) | ||
124 | { | ||
125 | SpawnPoint.RemoveAt(spawnpoint); | ||
126 | |||
127 | return TelehubVals(); | ||
128 | } | ||
129 | } | ||
130 | } \ 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 3164969..d4d0ad7 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 | |||
658 | public event ModifyTerrain OnModifyTerrain; | 658 | public event ModifyTerrain OnModifyTerrain; |
659 | public event BakeTerrain OnBakeTerrain; | 659 | public event BakeTerrain OnBakeTerrain; |
660 | public event EstateChangeInfo OnEstateChangeInfo; | 660 | public event EstateChangeInfo OnEstateChangeInfo; |
661 | public event EstateManageTelehub OnEstateManageTelehub; | ||
661 | public event SetAppearance OnSetAppearance; | 662 | public event SetAppearance OnSetAppearance; |
662 | public event AvatarNowWearing OnAvatarNowWearing; | 663 | public event AvatarNowWearing OnAvatarNowWearing; |
663 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 664 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
@@ -1537,6 +1538,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1537 | 1538 | ||
1538 | } | 1539 | } |
1539 | 1540 | ||
1541 | public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint) | ||
1542 | { | ||
1543 | |||
1544 | } | ||
1545 | |||
1540 | public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) | 1546 | public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) |
1541 | { | 1547 | { |
1542 | 1548 | ||
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 | |||
79 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 79 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
80 | 80 | ||
81 | lock (m_scenes) | 81 | lock (m_scenes) |
82 | m_scenes[scene.RegionInfo.RegionID] = scene; | 82 | m_scenes[scene.RegionInfo.RegionID] = scene; |
83 | |||
84 | scene.AddCommand( | ||
85 | this, "image queues clear", | ||
86 | "image queues clear <first-name> <last-name>", | ||
87 | "Clear the image queues (textures downloaded via UDP) for a particular client.", | ||
88 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); | ||
89 | |||
90 | scene.AddCommand( | ||
91 | this, "show image queues", | ||
92 | "image queues show <first-name> <last-name>", | ||
93 | "Show the image queues (textures downloaded via UDP) for a particular client.", | ||
94 | (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); | ||
83 | 95 | ||
84 | scene.AddCommand( | 96 | scene.AddCommand( |
85 | this, "show pqueues", | 97 | this, "show pqueues", |
@@ -116,7 +128,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
116 | "emergency-monitoring", | 128 | "emergency-monitoring", |
117 | "Go on/off emergency monitoring mode", | 129 | "Go on/off emergency monitoring mode", |
118 | "Go on/off emergency monitoring mode", | 130 | "Go on/off emergency monitoring mode", |
119 | EmergencyMonitoring); | 131 | HandleEmergencyMonitoring); |
120 | } | 132 | } |
121 | 133 | ||
122 | public void RemoveRegion(Scene scene) | 134 | public void RemoveRegion(Scene scene) |
@@ -132,7 +144,49 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
132 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 144 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
133 | } | 145 | } |
134 | 146 | ||
135 | protected void EmergencyMonitoring(string module, string[] cmd) | 147 | protected string HandleImageQueuesClear(string[] cmd) |
148 | { | ||
149 | if (cmd.Length != 5) | ||
150 | return "Usage: image queues clear <first-name> <last-name>"; | ||
151 | |||
152 | string firstName = cmd[3]; | ||
153 | string lastName = cmd[4]; | ||
154 | |||
155 | List<ScenePresence> foundAgents = new List<ScenePresence>(); | ||
156 | |||
157 | lock (m_scenes) | ||
158 | { | ||
159 | foreach (Scene scene in m_scenes.Values) | ||
160 | { | ||
161 | ScenePresence sp = scene.GetScenePresence(firstName, lastName); | ||
162 | if (sp != null) | ||
163 | foundAgents.Add(sp); | ||
164 | } | ||
165 | } | ||
166 | |||
167 | if (foundAgents.Count == 0) | ||
168 | return string.Format("No agents found for {0} {1}", firstName, lastName); | ||
169 | |||
170 | StringBuilder report = new StringBuilder(); | ||
171 | |||
172 | foreach (ScenePresence agent in foundAgents) | ||
173 | { | ||
174 | LLClientView client = agent.ControllingClient as LLClientView; | ||
175 | |||
176 | if (client == null) | ||
177 | return "This command is only supported for LLClientView"; | ||
178 | |||
179 | int requestsDeleted = client.ImageManager.ClearImageQueue(); | ||
180 | |||
181 | report.AppendFormat( | ||
182 | "In region {0} ({1} agent) cleared {2} requests\n", | ||
183 | agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted); | ||
184 | } | ||
185 | |||
186 | return report.ToString(); | ||
187 | } | ||
188 | |||
189 | protected void HandleEmergencyMonitoring(string module, string[] cmd) | ||
136 | { | 190 | { |
137 | bool mode = true; | 191 | bool mode = true; |
138 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) | 192 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) |
@@ -239,10 +293,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
239 | private string GetImageQueuesReport(string[] showParams) | 293 | private string GetImageQueuesReport(string[] showParams) |
240 | { | 294 | { |
241 | if (showParams.Length < 5 || showParams.Length > 6) | 295 | if (showParams.Length < 5 || showParams.Length > 6) |
242 | { | 296 | return "Usage: show image queues <first-name> <last-name> [full]"; |
243 | MainConsole.Instance.OutputFormat("Usage: show image queues <first-name> <last-name> [full]"); | ||
244 | return ""; | ||
245 | } | ||
246 | 297 | ||
247 | string firstName = showParams[3]; | 298 | string firstName = showParams[3]; |
248 | string lastName = showParams[4]; | 299 | string lastName = showParams[4]; |
@@ -262,10 +313,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
262 | } | 313 | } |
263 | 314 | ||
264 | if (foundAgents.Count == 0) | 315 | if (foundAgents.Count == 0) |
265 | { | 316 | return string.Format("No agents found for {0} {1}", firstName, lastName); |
266 | MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName); | ||
267 | return ""; | ||
268 | } | ||
269 | 317 | ||
270 | StringBuilder report = new StringBuilder(); | 318 | StringBuilder report = new StringBuilder(); |
271 | 319 | ||
@@ -274,10 +322,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
274 | LLClientView client = agent.ControllingClient as LLClientView; | 322 | LLClientView client = agent.ControllingClient as LLClientView; |
275 | 323 | ||
276 | if (client == null) | 324 | if (client == null) |
277 | { | 325 | return "This command is only supported for LLClientView"; |
278 | MainConsole.Instance.OutputFormat("This command is only supported for LLClientView"); | ||
279 | return ""; | ||
280 | } | ||
281 | 326 | ||
282 | J2KImage[] images = client.ImageManager.GetImages(); | 327 | J2KImage[] images = client.ImageManager.GetImages(); |
283 | 328 | ||
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 | |||
243 | 243 | ||
244 | public void OarLoadingAlert(string msg) | 244 | public void OarLoadingAlert(string msg) |
245 | { | 245 | { |
246 | // Let's bypass this for now until some better feedback can be established | ||
247 | // | ||
248 | return; | ||
249 | |||
246 | if (msg == "load") | 250 | if (msg == "load") |
247 | { | 251 | { |
248 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; | 252 | m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; |
@@ -251,7 +255,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady | |||
251 | m_scene.EventManager.OnRezScript += OnRezScript; | 255 | m_scene.EventManager.OnRezScript += OnRezScript; |
252 | m_oarFileLoading = true; | 256 | m_oarFileLoading = true; |
253 | m_firstEmptyCompileQueue = true; | 257 | m_firstEmptyCompileQueue = true; |
254 | // Will need some controls around this | 258 | |
255 | m_scene.LoginsDisabled = true; | 259 | m_scene.LoginsDisabled = true; |
256 | m_scene.LoginLock = true; | 260 | m_scene.LoginLock = true; |
257 | if ( m_uri != string.Empty ) | 261 | if ( m_uri != string.Empty ) |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index b4181a4..182bdda 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -32,6 +32,7 @@ using OpenMetaverse; | |||
32 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Region.CoreModules.World.Estate; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.OptionalModules.World.NPC | 37 | namespace OpenSim.Region.OptionalModules.World.NPC |
37 | { | 38 | { |
@@ -334,6 +335,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
334 | public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; | 335 | public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; |
335 | public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; | 336 | public event EstateTeleportAllUsersHomeRequest OnEstateTeleportAllUsersHomeRequest; |
336 | public event EstateChangeInfo OnEstateChangeInfo; | 337 | public event EstateChangeInfo OnEstateChangeInfo; |
338 | public event EstateManageTelehub OnEstateManageTelehub; | ||
337 | public event ScriptReset OnScriptReset; | 339 | public event ScriptReset OnScriptReset; |
338 | public event GetScriptRunning OnGetScriptRunning; | 340 | public event GetScriptRunning OnGetScriptRunning; |
339 | public event SetScriptRunning OnSetScriptRunning; | 341 | public event SetScriptRunning OnSetScriptRunning; |
@@ -927,6 +929,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
927 | public void SendEstateCovenantInformation(UUID covenant) | 929 | public void SendEstateCovenantInformation(UUID covenant) |
928 | { | 930 | { |
929 | } | 931 | } |
932 | public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List<Vector3> SpawnPoint) | ||
933 | { | ||
934 | } | ||
930 | public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) | 935 | public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) |
931 | { | 936 | { |
932 | } | 937 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 37792ef..4831377 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1953,6 +1953,69 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1953 | } | 1953 | } |
1954 | } | 1954 | } |
1955 | 1955 | ||
1956 | private enum InfoType | ||
1957 | { | ||
1958 | Nick, | ||
1959 | Name, | ||
1960 | Login, | ||
1961 | Home, | ||
1962 | Custom | ||
1963 | }; | ||
1964 | |||
1965 | private string GridUserInfo(InfoType type) | ||
1966 | { | ||
1967 | return GridUserInfo(type, ""); | ||
1968 | } | ||
1969 | |||
1970 | private string GridUserInfo(InfoType type, string key) | ||
1971 | { | ||
1972 | string retval = String.Empty; | ||
1973 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
1974 | string url = config.Configs["GridInfo"].GetString("GridInfoURI", String.Empty); | ||
1975 | |||
1976 | if (String.IsNullOrEmpty(url)) | ||
1977 | return "Configuration Error!"; | ||
1978 | |||
1979 | string verb ="/json_grid_info"; | ||
1980 | OSDMap json = new OSDMap(); | ||
1981 | |||
1982 | OSDMap info = WebUtil.GetFromService(String.Format("{0}{1}",url,verb), 3000); | ||
1983 | |||
1984 | if (info["Success"] != true) | ||
1985 | return "Get GridInfo Failed!"; | ||
1986 | |||
1987 | json = (OSDMap)OSDParser.DeserializeJson(info["_RawResult"].AsString()); | ||
1988 | |||
1989 | switch (type) | ||
1990 | { | ||
1991 | case InfoType.Nick: | ||
1992 | retval = json["gridnick"]; | ||
1993 | break; | ||
1994 | |||
1995 | case InfoType.Name: | ||
1996 | retval = json["gridname"]; | ||
1997 | break; | ||
1998 | |||
1999 | case InfoType.Login: | ||
2000 | retval = json["login"]; | ||
2001 | break; | ||
2002 | |||
2003 | case InfoType.Home: | ||
2004 | retval = json["home"]; | ||
2005 | break; | ||
2006 | |||
2007 | case InfoType.Custom: | ||
2008 | retval = json[key]; | ||
2009 | break; | ||
2010 | |||
2011 | default: | ||
2012 | retval = "error"; | ||
2013 | break; | ||
2014 | } | ||
2015 | |||
2016 | return retval; | ||
2017 | } | ||
2018 | |||
1956 | /// <summary> | 2019 | /// <summary> |
1957 | /// Get the nickname of this grid, as set in the [GridInfo] config section. | 2020 | /// Get the nickname of this grid, as set in the [GridInfo] config section. |
1958 | /// </summary> | 2021 | /// </summary> |
@@ -1966,10 +2029,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1966 | { | 2029 | { |
1967 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); | 2030 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); |
1968 | m_host.AddScriptLPS(1); | 2031 | m_host.AddScriptLPS(1); |
1969 | string nick = "hippogrid"; | 2032 | |
2033 | string nick = String.Empty; | ||
1970 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2034 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2035 | |||
1971 | if (config.Configs["GridInfo"] != null) | 2036 | if (config.Configs["GridInfo"] != null) |
1972 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); | 2037 | nick = config.Configs["GridInfo"].GetString("gridnick", nick); |
2038 | |||
2039 | if (String.IsNullOrEmpty(nick)) | ||
2040 | nick = GridUserInfo(InfoType.Nick); | ||
2041 | |||
1973 | return nick; | 2042 | return nick; |
1974 | } | 2043 | } |
1975 | 2044 | ||
@@ -1977,10 +2046,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1977 | { | 2046 | { |
1978 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); | 2047 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridName"); |
1979 | m_host.AddScriptLPS(1); | 2048 | m_host.AddScriptLPS(1); |
1980 | string name = "the lost continent of hippo"; | 2049 | |
2050 | string name = String.Empty; | ||
1981 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2051 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2052 | |||
1982 | if (config.Configs["GridInfo"] != null) | 2053 | if (config.Configs["GridInfo"] != null) |
1983 | name = config.Configs["GridInfo"].GetString("gridname", name); | 2054 | name = config.Configs["GridInfo"].GetString("gridname", name); |
2055 | |||
2056 | if (String.IsNullOrEmpty(name)) | ||
2057 | name = GridUserInfo(InfoType.Name); | ||
2058 | |||
1984 | return name; | 2059 | return name; |
1985 | } | 2060 | } |
1986 | 2061 | ||
@@ -1988,13 +2063,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1988 | { | 2063 | { |
1989 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); | 2064 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); |
1990 | m_host.AddScriptLPS(1); | 2065 | m_host.AddScriptLPS(1); |
1991 | string loginURI = "http://127.0.0.1:9000/"; | 2066 | |
2067 | string loginURI = String.Empty; | ||
1992 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2068 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2069 | |||
1993 | if (config.Configs["GridInfo"] != null) | 2070 | if (config.Configs["GridInfo"] != null) |
1994 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); | 2071 | loginURI = config.Configs["GridInfo"].GetString("login", loginURI); |
2072 | |||
2073 | if (String.IsNullOrEmpty(loginURI)) | ||
2074 | loginURI = GridUserInfo(InfoType.Login); | ||
2075 | |||
1995 | return loginURI; | 2076 | return loginURI; |
1996 | } | 2077 | } |
1997 | 2078 | ||
2079 | public string osGetGridHomeURI() | ||
2080 | { | ||
2081 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); | ||
2082 | m_host.AddScriptLPS(1); | ||
2083 | |||
2084 | string HomeURI = String.Empty; | ||
2085 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2086 | |||
2087 | if (config.Configs["LoginService"] != null) | ||
2088 | HomeURI = config.Configs["LoginService"].GetString("SRV_HomeURI", HomeURI); | ||
2089 | |||
2090 | if (String.IsNullOrEmpty(HomeURI)) | ||
2091 | HomeURI = GridUserInfo(InfoType.Home); | ||
2092 | |||
2093 | return HomeURI; | ||
2094 | } | ||
2095 | |||
2096 | public string osGetGridCustom(string key) | ||
2097 | { | ||
2098 | CheckThreatLevel(ThreatLevel.Moderate, "osGetGridCustom"); | ||
2099 | m_host.AddScriptLPS(1); | ||
2100 | |||
2101 | string retval = String.Empty; | ||
2102 | IConfigSource config = m_ScriptEngine.ConfigSource; | ||
2103 | |||
2104 | if (config.Configs["GridInfo"] != null) | ||
2105 | retval = config.Configs["GridInfo"].GetString(key, retval); | ||
2106 | |||
2107 | if (String.IsNullOrEmpty(retval)) | ||
2108 | retval = GridUserInfo(InfoType.Custom, key); | ||
2109 | |||
2110 | return retval; | ||
2111 | } | ||
2112 | |||
1998 | public LSL_String osFormatString(string str, LSL_List strings) | 2113 | public LSL_String osFormatString(string str, LSL_List strings) |
1999 | { | 2114 | { |
2000 | CheckThreatLevel(ThreatLevel.Low, "osFormatString"); | 2115 | 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 403e491..6388704 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -160,6 +160,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
160 | string osGetGridNick(); | 160 | string osGetGridNick(); |
161 | string osGetGridName(); | 161 | string osGetGridName(); |
162 | string osGetGridLoginURI(); | 162 | string osGetGridLoginURI(); |
163 | string osGetGridHomeURI(); | ||
164 | string osGetGridCustom(string key); | ||
163 | 165 | ||
164 | LSL_String osFormatString(string str, LSL_List strings); | 166 | LSL_String osFormatString(string str, LSL_List strings); |
165 | LSL_List osMatchString(string src, string pattern, int start); | 167 | 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..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,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
452 | return m_OSSL_Functions.osGetGridLoginURI(); | 452 | return m_OSSL_Functions.osGetGridLoginURI(); |
453 | } | 453 | } |
454 | 454 | ||
455 | public string osGetGridHomeURI() | ||
456 | { | ||
457 | return m_OSSL_Functions.osGetGridHomeURI(); | ||
458 | } | ||
459 | |||
460 | public string osGetGridCustom(string key) | ||
461 | { | ||
462 | return m_OSSL_Functions.osGetGridCustom(key); | ||
463 | } | ||
464 | |||
455 | public LSL_String osFormatString(string str, LSL_List strings) | 465 | public LSL_String osFormatString(string str, LSL_List strings) |
456 | { | 466 | { |
457 | return m_OSSL_Functions.osFormatString(str, strings); | 467 | return m_OSSL_Functions.osFormatString(str, strings); |